mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +00:00
fix(smoothscroll): crash when resizing to textoff with showbreak
vim-patch:9.2.0362: division by zero with smoothscroll and small windows
Problem: Resizing a smoothscrolled wrapped window to its textoff width
with 'showbreak' can leave wrapped continuation lines with
zero text width. win_lbr_chartabsize() still runs the partial max_head_vcol calculation in
that state and divides by width2, crashing during redraw.
Solution: Skip that partial head calculation when the wrapped
continuation width is zero, matching the other width2 guards
in charset.c (Jaehwang Jung)
closes: vim/vim#20012
AI-assisted: Codex
0e31fb024c
(cherry picked from commit 79a7a4abe1)
This commit is contained in:
committed by
github-actions[bot]
parent
9966afbc9d
commit
898ccbc68a
@@ -269,7 +269,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
|
||||
if (max_head_vcol == 0 || vcol + size + added < max_head_vcol) {
|
||||
head += cnt * head_mid;
|
||||
} else if (max_head_vcol > vcol + head_prev + prev_rem) {
|
||||
} else if (width2 > 0 && max_head_vcol > vcol + head_prev + prev_rem) {
|
||||
head += (max_head_vcol - (vcol + head_prev + prev_rem)
|
||||
+ width2 - 1) / width2 * head_mid;
|
||||
} else if (max_head_vcol < 0) {
|
||||
|
||||
Reference in New Issue
Block a user