patch 9.1.1554: crash when omni-completion opens command-line window

Commit: 
https://github.com/vim/vim/commit/e4fdb1e4e7583d824d4d86efa9b507c218d0af6a
Author: Girish Palya <giris...@gmail.com>
Date:   Wed Jul 16 18:54:54 2025 +0200

    patch 9.1.1554: crash when omni-completion opens command-line window
    
    Problem:  Vim crashes during omnifunc completion inside the command-line
              window ("q:") if the completion item attempts to open an "info"
              preview window. This leads to a failed assert during execution.
    Solution: Avoid opening preview windows while inside the command-line
              window to prevent the crash (Girish Palya).
    
    closes: #17764
    
    Co-authored-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Girish Palya <giris...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/po/vim.pot b/src/po/vim.pot
index 43e194e92..dcead5ccf 100644
--- a/src/po/vim.pot
+++ b/src/po/vim.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION
"
 "Report-Msgid-Bugs-To: 
"
-"POT-Creation-Date: 2025-07-16 18:34+0200
"
+"POT-Creation-Date: 2025-07-16 18:54+0200
"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>
"
 "Language-Team: LANGUAGE <l...@li.org>
"
@@ -4257,327 +4257,327 @@ msgstr ""
 msgid "%s (%s, compiled %s)"
 msgstr ""
 
-#: ../version.c:4040
+#: ../version.c:4042
 msgid ""
 "
"
 "MS-Windows ARM64 GUI/console version"
 msgstr ""
 
-#: ../version.c:4042
+#: ../version.c:4044
 msgid ""
 "
"
 "MS-Windows 64-bit GUI/console version"
 msgstr ""
 
-#: ../version.c:4045
+#: ../version.c:4047
 msgid ""
 "
"
 "MS-Windows 32-bit GUI/console version"
 msgstr ""
 
-#: ../version.c:4050
+#: ../version.c:4052
 msgid ""
 "
"
 "MS-Windows ARM64 GUI version"
 msgstr ""
 
-#: ../version.c:4052
+#: ../version.c:4054
 msgid ""
 "
"
 "MS-Windows 64-bit GUI version"
 msgstr ""
 
-#: ../version.c:4055
+#: ../version.c:4057
 msgid ""
 "
"
 "MS-Windows 32-bit GUI version"
 msgstr ""
 
-#: ../version.c:4059
+#: ../version.c:4061
 msgid " with OLE support"
 msgstr ""
 
-#: ../version.c:4064
+#: ../version.c:4066
 msgid ""
 "
"
 "MS-Windows ARM64 console version"
 msgstr ""
 
-#: ../version.c:4066
+#: ../version.c:4068
 msgid ""
 "
"
 "MS-Windows 64-bit console version"
 msgstr ""
 
-#: ../version.c:4069
+#: ../version.c:4071
 msgid ""
 "
"
 "MS-Windows 32-bit console version"
 msgstr ""
 
-#: ../version.c:4075
+#: ../version.c:4077
 msgid ""
 "
"
 "macOS version"
 msgstr ""
 
-#: ../version.c:4077
+#: ../version.c:4079
 msgid ""
 "
"
 "macOS version w/o darwin feat."
 msgstr ""
 
-#: ../version.c:4087
+#: ../version.c:4089
 msgid ""
 "
"
 "OpenVMS version"
 msgstr ""
 
-#: ../version.c:4102
+#: ../version.c:4104
 msgid ""
 "
"
 "Included patches: "
 msgstr ""
 
-#: ../version.c:4127
+#: ../version.c:4129
 msgid ""
 "
"
 "Extra patches: "
 msgstr ""
 
-#: ../version.c:4139 ../version.c:4450
+#: ../version.c:4141 ../version.c:4452
 msgid "Modified by "
 msgstr ""
 
-#: ../version.c:4146
+#: ../version.c:4148
 msgid ""
 "
"
 "Compiled "
 msgstr ""
 
-#: ../version.c:4149
+#: ../version.c:4151
 msgid "by "
 msgstr ""
 
-#: ../version.c:4161
+#: ../version.c:4163
 msgid ""
 "
"
 "Huge version "
 msgstr ""
 
-#: ../version.c:4163
+#: ../version.c:4165
 msgid ""
 "
"
 "Normal version "
 msgstr ""
 
-#: ../version.c:4165
+#: ../version.c:4167
 msgid ""
 "
"
 "Tiny version "
 msgstr ""
 
-#: ../version.c:4168
+#: ../version.c:4170
 msgid "without GUI."
 msgstr ""
 
-#: ../version.c:4171
+#: ../version.c:4173
 msgid "with GTK3 GUI."
 msgstr ""
 
-#: ../version.c:4173
+#: ../version.c:4175
 msgid "with GTK2-GNOME GUI."
 msgstr ""
 
-#: ../version.c:4175
+#: ../version.c:4177
 msgid "with GTK2 GUI."
 msgstr ""
 
-#: ../version.c:4178
+#: ../version.c:4180
 msgid "with X11-Motif GUI."
 msgstr ""
 
-#: ../version.c:4180
+#: ../version.c:4182
 msgid "with Haiku GUI."
 msgstr ""
 
-#: ../version.c:4182
+#: ../version.c:4184
 msgid "with Photon GUI."
 msgstr ""
 
-#: ../version.c:4184
+#: ../version.c:4186
 msgid "with GUI."
 msgstr ""
 
-#: ../version.c:4186
+#: ../version.c:4188
 msgid "  Features included (+) or not (-):
"
 msgstr ""
 
-#: ../version.c:4193
+#: ../version.c:4195
 msgid "   system vimrc file: \""
 msgstr ""
 
-#: ../version.c:4198
+#: ../version.c:4200
 msgid "     user vimrc file: \""
 msgstr ""
 
-#: ../version.c:4203
+#: ../version.c:4205
 msgid " 2nd user vimrc file: \""
 msgstr ""
 
-#: ../version.c:4208 ../version.c:4215 ../version.c:4219
+#: ../version.c:4210 ../version.c:4217 ../version.c:4221
 msgid " 3rd user vimrc file: \""
 msgstr ""
 
-#: ../version.c:4211
+#: ../version.c:4213
 msgid " 4th user vimrc file: \""
 msgstr ""
 
-#: ../version.c:4224
+#: ../version.c:4226
 msgid "      user exrc file: \""
 msgstr ""
 
-#: ../version.c:4229
+#: ../version.c:4231
 msgid "  2nd user exrc file: \""
 msgstr ""
 
-#: ../version.c:4235
+#: ../version.c:4237
 msgid "  system gvimrc file: \""
 msgstr ""
 
-#: ../version.c:4239
+#: ../version.c:4241
 msgid "    user gvimrc file: \""
 msgstr ""
 
-#: ../version.c:4243
+#: ../version.c:4245
 msgid "2nd user gvimrc file: \""
 msgstr ""
 
-#: ../version.c:4248
+#: ../version.c:4250
 msgid "3rd user gvimrc file: \""
 msgstr ""
 
-#: ../version.c:4253
+#: ../version.c:4255
 msgid "       defaults file: \""
 msgstr ""
 
-#: ../version.c:4258
+#: ../version.c:4260
 msgid "    system menu file: \""
 msgstr ""
 
-#: ../version.c:4266
+#: ../version.c:4268
 msgid "  fall-back for $VIM: \""
 msgstr ""
 
-#: ../version.c:4272
+#: ../version.c:4274
 msgid " f-b for $VIMRUNTIME: \""
 msgstr ""
 
-#: ../version.c:4276
+#: ../version.c:4278
 msgid "Compilation: "
 msgstr ""
 
-#: ../version.c:4282
+#: ../version.c:4284
 msgid "Compiler: "
 msgstr ""
 
-#: ../version.c:4287
+#: ../version.c:4289
 msgid "Linking: "
 msgstr ""
 
-#: ../version.c:4292
+#: ../version.c:4294
 msgid "  DEBUG BUILD"
 msgstr ""
 
-#: ../version.c:4328
+#: ../version.c:4330
 msgid "VIM - Vi IMproved"
 msgstr ""
 
-#: ../version.c:4330
+#: ../version.c:4332
 msgid "version "
 msgstr ""
 
-#: ../version.c:4331
+#: ../version.c:4333
 msgid "by Bram Moolenaar et al."
 msgstr ""
 
-#: ../version.c:4335
+#: ../version.c:4337
 msgid "Vim is open source and freely distributable"
 msgstr ""
 
-#: ../version.c:4337
+#: ../version.c:4339
 msgid "Help poor children in Uganda!"
 msgstr ""
 
-#: ../version.c:4338
+#: ../version.c:4340
 msgid "type  :help iccf<Enter>       for information "
 msgstr ""
 
-#: ../version.c:4340
+#: ../version.c:4342
 msgid "type  :q<Enter>               to exit         "
 msgstr ""
 
-#: ../version.c:4341
+#: ../version.c:4343
 msgid "type  :help<Enter>  or  <F1>  for on-line help"
 msgstr ""
 
-#: ../version.c:4342
+#: ../version.c:4344
 msgid "type  :help version9<Enter>   for version info"
 msgstr ""
 
-#: ../version.c:4345
+#: ../version.c:4347
 msgid "Running in Vi compatible mode"
 msgstr ""
 
-#: ../version.c:4346
+#: ../version.c:4348
 msgid "type  :set nocp<Enter>        for Vim defaults"
 msgstr ""
 
-#: ../version.c:4347
+#: ../version.c:4349
 msgid "type  :help cp-default<Enter> for info on this"
 msgstr ""
 
-#: ../version.c:4362
+#: ../version.c:4364
 msgid "menu  Help->Orphans           for information    "
 msgstr ""
 
-#: ../version.c:4364
+#: ../version.c:4366
 msgid "Running modeless, typed text is inserted"
 msgstr ""
 
-#: ../version.c:4365
+#: ../version.c:4367
 msgid "menu  Edit->Global Settings->Toggle Insert Mode  "
 msgstr ""
 
-#: ../version.c:4366
+#: ../version.c:4368
 msgid "                              for two modes      "
 msgstr ""
 
-#: ../version.c:4370
+#: ../version.c:4372
 msgid "menu  Edit->Global Settings->Toggle Vi Compatible"
 msgstr ""
 
-#: ../version.c:4371
+#: ../version.c:4373
 msgid "                              for Vim defaults   "
 msgstr ""
 
-#: ../version.c:4412
+#: ../version.c:4414
 msgid "Sponsor Vim development!"
 msgstr ""
 
-#: ../version.c:4413
+#: ../version.c:4415
 msgid "Become a registered Vim user!"
 msgstr ""
 
-#: ../version.c:4416
+#: ../version.c:4418
 msgid "type  :help sponsor<Enter>    for information "
 msgstr ""
 
-#: ../version.c:4417
+#: ../version.c:4419
 msgid "type  :help register<Enter>   for information "
 msgstr ""
 
-#: ../version.c:4419
+#: ../version.c:4421
 msgid "menu  Help->Sponsor/Register  for information    "
 msgstr ""
 
diff --git a/src/popupmenu.c b/src/popupmenu.c
index eecddc5be..fa6d9a518 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -1159,12 +1159,14 @@ pum_set_selected(int n, int repeat UNUSED)
         * 'completeopt' contains "preview" or "popup" or "popuphidden".
         * Skip this when tried twice already.
         * Skip this also when there is not much room.
+        * Skip this for command-window when 'completeopt' contains "preview".
         * NOTE: Be very careful not to sync undo!
         */
        if (pum_array[pum_selected].pum_info != NULL
                && Rows > 10
                && repeat <= 1
-               && (cur_cot_flags & COT_ANY_PREVIEW))
+               && (cur_cot_flags & COT_ANY_PREVIEW)
+               && !((cur_cot_flags & COT_PREVIEW) && cmdwin_type != 0))
        {
            win_T       *curwin_save = curwin;
            tabpage_T   *curtab_save = curtab;
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 2ae01656f..b8c318585 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -2278,5 +2278,18 @@ func Test_pum_position_when_wrap()
   call StopVimInTerminal(buf)
 endfunc
 
+" Test that Vim does not crash when completion inside cmdwin opens a 'info'
+" preview window.
+func Test_popup_complete_cmdwin_preview()
+  func! CompleteWithPreview(findstart, base)
+    if a:findstart
+      return getline('.')->strpart(0, col('.') - 1)
+    endif
+    return [#{word: 'echo', info: 'bar'}, #{word: 'echomsg', info: 'baz'}]
+  endfunc
+  set omnifunc=CompleteWithPreview
+  call feedkeys("q:if\<C-X>\<C-O>\<C-N>\<ESC>\<CR>", 'tx!')
+  set omnifunc&
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 1ffb15426..3e4151b4d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1554,
 /**/
     1553,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uc5UB-009VbD-JL%40256bit.org.

Raspunde prin e-mail lui