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 <zeertzjq@outlook.com>
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-07-16 18:54:54 +02:00
committed by Christian Brabandt
parent 7dd8ee2103
commit e4fdb1e4e7
4 changed files with 99 additions and 82 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-16 18:34+0200\n"
"POT-Creation-Date: 2025-07-16 18:54+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -4257,327 +4257,327 @@ msgstr ""
msgid "%s (%s, compiled %s)"
msgstr ""
#: ../version.c:4040
#: ../version.c:4042
msgid ""
"\n"
"MS-Windows ARM64 GUI/console version"
msgstr ""
#: ../version.c:4042
#: ../version.c:4044
msgid ""
"\n"
"MS-Windows 64-bit GUI/console version"
msgstr ""
#: ../version.c:4045
#: ../version.c:4047
msgid ""
"\n"
"MS-Windows 32-bit GUI/console version"
msgstr ""
#: ../version.c:4050
#: ../version.c:4052
msgid ""
"\n"
"MS-Windows ARM64 GUI version"
msgstr ""
#: ../version.c:4052
#: ../version.c:4054
msgid ""
"\n"
"MS-Windows 64-bit GUI version"
msgstr ""
#: ../version.c:4055
#: ../version.c:4057
msgid ""
"\n"
"MS-Windows 32-bit GUI version"
msgstr ""
#: ../version.c:4059
#: ../version.c:4061
msgid " with OLE support"
msgstr ""
#: ../version.c:4064
msgid ""
"\n"
"MS-Windows ARM64 console version"
msgstr ""
#: ../version.c:4066
msgid ""
"\n"
"MS-Windows ARM64 console version"
msgstr ""
#: ../version.c:4068
msgid ""
"\n"
"MS-Windows 64-bit console version"
msgstr ""
#: ../version.c:4069
#: ../version.c:4071
msgid ""
"\n"
"MS-Windows 32-bit console version"
msgstr ""
#: ../version.c:4075
#: ../version.c:4077
msgid ""
"\n"
"macOS version"
msgstr ""
#: ../version.c:4077
#: ../version.c:4079
msgid ""
"\n"
"macOS version w/o darwin feat."
msgstr ""
#: ../version.c:4087
#: ../version.c:4089
msgid ""
"\n"
"OpenVMS version"
msgstr ""
#: ../version.c:4102
#: ../version.c:4104
msgid ""
"\n"
"Included patches: "
msgstr ""
#: ../version.c:4127
#: ../version.c:4129
msgid ""
"\n"
"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 ""
"\n"
"Compiled "
msgstr ""
#: ../version.c:4149
#: ../version.c:4151
msgid "by "
msgstr ""
#: ../version.c:4161
msgid ""
"\n"
"Huge version "
msgstr ""
#: ../version.c:4163
msgid ""
"\n"
"Normal version "
"Huge version "
msgstr ""
#: ../version.c:4165
msgid ""
"\n"
"Normal version "
msgstr ""
#: ../version.c:4167
msgid ""
"\n"
"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 (-):\n"
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 ""

View File

@ -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;

View File

@ -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

View File

@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1554,
/**/
1553,
/**/