summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2026-04-19 02:16:31 +0900
committerzeertzjq <zeertzjq@outlook.com>2026-04-20 09:30:30 +0800
commit79a7a4abe11f9b678cbf7073a4464fbe8631d57a (patch)
tree1fe990acba034f69abffed3acccd847062ae9d84 /src
parenta433f1d0ac8bc677d91521a22e546cfc5ba6c423 (diff)
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 https://github.com/vim/vim/commit/0e31fb024c846e36bb0d26d01ff179a0d1b3eae4
Diffstat (limited to 'src')
-rw-r--r--src/nvim/plines.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index 1fafdf2206..12b40c1a5a 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -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) {