Commit: patch 9.2.0930: floating point exception when displaying pum

2 views
Skip to first unread message

Christian Brabandt

unread,
Aug 10, 2026, 3:45:18 PM (20 hours ago) Aug 10
to vim...@googlegroups.com
patch 9.2.0930: floating point exception when displaying pum

Commit: https://github.com/vim/vim/commit/5156deba71b471375d2c9158fd7eefe4301e3cec
Author: Christian Brabandt <c...@256bit.org>
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 <c...@256bit.org>

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,
/**/
Reply all
Reply to author
Forward
0 new messages