Commit: patch 9.2.0930: floating point exception when displaying pum
Christian Brabandt <[email protected]> Mon, 10 Aug 2026 21:45:06 +0200
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <[email protected]> |
patch 9.2.0930: floating point exception when displaying pum Commit: https://github.com/vim/vim/commit/5156deba71b471375d2c9158fd7eefe4301e3cec Author: Christian Brabandt <[email protected]> Date: Mon Aug 10 19:36:32 2026 +0000 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 <[email protected]> diff --git a/src/popupmenu.c b/src/popupmenu.c index 36000d9bf..47f9b297f 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 a4bba3f31..f5f2f1a7b 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\<C-N>\<Esc>", '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 e0bd6e1e0..ccd788a59 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, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wtVvm-005oWU-Bh%40256bit.org.