Skip to content

Commit a4baf5b

Browse files
committed
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Problem: CmdlineEnter command uses backslash instead of slash. Solution: Don't treat the character as a file name. (closes #2837)
1 parent ebe74b7 commit a4baf5b

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/fileio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9524,6 +9524,12 @@ apply_autocmds_group(
95249524
* ColorScheme, QuickFixCmd* or DirChanged */
95259525
if (event == EVENT_FILETYPE
95269526
|| event == EVENT_SYNTAX
9527+
|| event == EVENT_CMDLINECHANGED
9528+
|| event == EVENT_CMDLINEENTER
9529+
|| event == EVENT_CMDLINELEAVE
9530+
|| event == EVENT_CMDWINENTER
9531+
|| event == EVENT_CMDWINLEAVE
9532+
|| event == EVENT_CMDUNDEFINED
95279533
|| event == EVENT_FUNCUNDEFINED
95289534
|| event == EVENT_REMOTEREPLY
95299535
|| event == EVENT_SPELLFILEMISSING
@@ -9532,7 +9538,10 @@ apply_autocmds_group(
95329538
|| event == EVENT_OPTIONSET
95339539
|| event == EVENT_QUICKFIXCMDPOST
95349540
|| event == EVENT_DIRCHANGED)
9541+
{
95359542
fname = vim_strsave(fname);
9543+
autocmd_fname_full = TRUE; /* don't expand it later */
9544+
}
95369545
else
95379546
fname = FullName_save(fname, FALSE);
95389547
}

src/testdir/test_autocmd.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ func Test_Cmdline()
837837
au! CmdlineEnter
838838
au! CmdlineLeave
839839

840+
let save_shellslash = &shellslash
841+
set noshellslash
840842
au! CmdlineEnter / let g:entered = expand('<afile>')
841843
au! CmdlineLeave / let g:left = expand('<afile>')
842844
let g:entered = 0
@@ -849,6 +851,7 @@ func Test_Cmdline()
849851
bwipe!
850852
au! CmdlineEnter
851853
au! CmdlineLeave
854+
let &shellslash = save_shellslash
852855
endfunc
853856

854857
" Test for BufWritePre autocommand that deletes or unloads the buffer.

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1748,
764766
/**/
765767
1747,
766768
/**/

0 commit comments

Comments
 (0)