From: Christian Brabandt Date: Mon, 10 Aug 2026 19:36:32 +0000 (+0000) Subject: patch 9.2.0930: floating point exception when displaying pum X-Git-Tag: v9.2.0930^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5156deba71b471375d2c9158fd7eefe4301e3cec;p=thirdparty%2Fvim.git patch 9.2.0930: floating point exception when displaying pum Problem: floating point exception when displaying pum (dvaave2025) Solution: Verify that curwin->w_width > 0 fixes: #20985 closes: #20994 Supported by AI. Signed-off-by: Christian Brabandt --- diff --git a/src/popupmenu.c b/src/popupmenu.c index 36000d9bf0..47f9b297f7 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -363,7 +363,10 @@ pum_display( { int wcol = pum_wcol >= 0 ? pum_wcol : curwin->w_wcol; // w_wcol includes virtual text "above". - wcol %= curwin->w_width; + if (curwin->w_width > 0) + wcol %= curwin->w_width; + else + wcol = 0; #ifdef FEAT_CONCEAL // w_wcol does not account for text concealed before the cursor; // shift by the offset win_line() recorded for the cursor line so the diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index a4bba3f310..f5f2f1a7b7 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -2734,4 +2734,24 @@ func Test_popup_sandbox() call assert_fails('sandbox call popup_setoptions(1, {})', 'E48:') endfunc +func Test_pum_display_with_zero_width_window() + " Force curwin to width 0 (like Test_window_minimal_size does for + " win_ensure_size itself), then start completion via a non-typed, + " stuffed key sequence so KeyTyped stays FALSE and the repair is + " skipped. pum_display() must not divide by curwin->w_width in that + " state (would SIGFPE). + set winminwidth=0 + vert new + call win_execute(win_getid(2), 'wincmd |') + call assert_equal(0, winwidth(0)) + + call setline(1, ['foo', 'foobar', 'foo']) + call feedkeys("A\\", 'x') + call assert_equal(0, winwidth(0)) + + bwipe! + bwipe! + set winminwidth& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index e0bd6e1e05..ccd788a595 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 930, /**/ 929, /**/