Skip to content

Commit 3896a10

Browse files
committed
patch 8.2.1403: Vim9: Vim highlighting may fail in cmdline window
Problem: Vim9: Vim highlighting fails in cmdline window if it uses Vim9 commands. Solution: Allow using :vim9script, :import and :export while in the cmdline window. (closes #6656)
1 parent 94f6c06 commit 3896a10

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

src/ex_cmds.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ EXCMD(CMD_exit, "exit", ex_exit,
572572
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILE1|EX_ARGOPT|EX_DFLALL|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
573573
ADDR_LINES),
574574
EXCMD(CMD_export, "export", ex_export,
575-
EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK,
575+
EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK,
576576
ADDR_NONE),
577577
EXCMD(CMD_exusage, "exusage", ex_exusage,
578578
EX_TRLBAR,
@@ -698,7 +698,7 @@ EXCMD(CMD_imenu, "imenu", ex_menu,
698698
EX_RANGE|EX_ZEROR|EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK,
699699
ADDR_OTHER),
700700
EXCMD(CMD_import, "import", ex_import,
701-
EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK,
701+
EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK,
702702
ADDR_NONE),
703703
EXCMD(CMD_inoremap, "inoremap", ex_map,
704704
EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK,
@@ -1670,7 +1670,7 @@ EXCMD(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep,
16701670
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
16711671
ADDR_OTHER),
16721672
EXCMD(CMD_vim9script, "vim9script", ex_vim9script,
1673-
EX_LOCK_OK,
1673+
EX_CMDWIN|EX_LOCK_OK,
16741674
ADDR_NONE),
16751675
EXCMD(CMD_viusage, "viusage", ex_viusage,
16761676
EX_TRLBAR,

src/testdir/test_vim9_script.vim

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,37 @@ def Test_vim9_autoload()
30093009
&rtp = save_rtp
30103010
enddef
30113011

3012+
def Test_cmdline_win()
3013+
# if the Vim syntax highlighting uses Vim9 constructs they can be used from
3014+
# the command line window.
3015+
mkdir('rtp/syntax', 'p')
3016+
let export_lines =<< trim END
3017+
vim9script
3018+
export let That = 'yes'
3019+
END
3020+
writefile(export_lines, 'rtp/syntax/Xexport.vim')
3021+
let import_lines =<< trim END
3022+
vim9script
3023+
import That from './Xexport.vim'
3024+
END
3025+
writefile(import_lines, 'rtp/syntax/vim.vim')
3026+
let save_rtp = &rtp
3027+
&rtp = getcwd() .. '/rtp' .. ',' .. &rtp
3028+
syntax on
3029+
augroup CmdWin
3030+
autocmd CmdwinEnter * g:got_there = 'yes'
3031+
augroup END
3032+
# this will open and also close the cmdline window
3033+
feedkeys('q:', 'xt')
3034+
assert_equal('yes', g:got_there)
3035+
3036+
augroup CmdWin
3037+
au!
3038+
augroup END
3039+
&rtp = save_rtp
3040+
delete('rtp', 'rf')
3041+
enddef
3042+
30123043
" Keep this last, it messes up highlighting.
30133044
def Test_substitute_cmd()
30143045
new

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1403,
757759
/**/
758760
1402,
759761
/**/

0 commit comments

Comments
 (0)