forked from aniani/vim
patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visible
Problem: When quitting the cmdline window with CTRL-C it remains visible. Solution: Redraw to avoid confusion. Adjust the error message. (closes #11152) Adjust the cursor position after CTRL-C.
This commit is contained in:
@@ -17,7 +17,7 @@ EXTERN char e_backslash_should_be_followed_by[]
|
|||||||
INIT(= N_("E10: \\ should be followed by /, ? or &"));
|
INIT(= N_("E10: \\ should be followed by /, ? or &"));
|
||||||
#ifdef FEAT_CMDWIN
|
#ifdef FEAT_CMDWIN
|
||||||
EXTERN char e_invalid_in_cmdline_window[]
|
EXTERN char e_invalid_in_cmdline_window[]
|
||||||
INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
|
INIT(= N_("E11: Invalid in command-line window; :q<CR> closes the window"));
|
||||||
#endif
|
#endif
|
||||||
EXTERN char e_command_not_allowed_from_vimrc_in_current_dir_or_tag_search[]
|
EXTERN char e_command_not_allowed_from_vimrc_in_current_dir_or_tag_search[]
|
||||||
INIT(= N_("E12: Command not allowed from exrc/vimrc in current dir or tag search"));
|
INIT(= N_("E12: Command not allowed from exrc/vimrc in current dir or tag search"));
|
||||||
|
@@ -4631,13 +4631,11 @@ open_cmdwin(void)
|
|||||||
ccline.cmdlen = (int)STRLEN(ccline.cmdbuff);
|
ccline.cmdlen = (int)STRLEN(ccline.cmdbuff);
|
||||||
ccline.cmdbufflen = ccline.cmdlen + 1;
|
ccline.cmdbufflen = ccline.cmdlen + 1;
|
||||||
ccline.cmdpos = curwin->w_cursor.col;
|
ccline.cmdpos = curwin->w_cursor.col;
|
||||||
if (ccline.cmdpos > ccline.cmdlen)
|
// If the cursor is on the last character, it probably should be
|
||||||
|
// after it.
|
||||||
|
if (ccline.cmdpos == ccline.cmdlen - 1
|
||||||
|
|| ccline.cmdpos > ccline.cmdlen)
|
||||||
ccline.cmdpos = ccline.cmdlen;
|
ccline.cmdpos = ccline.cmdlen;
|
||||||
if (cmdwin_result == K_IGNORE)
|
|
||||||
{
|
|
||||||
set_cmdspos_cursor();
|
|
||||||
redrawcmd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
@@ -4664,6 +4662,15 @@ open_cmdwin(void)
|
|||||||
// Restore window sizes.
|
// Restore window sizes.
|
||||||
win_size_restore(&winsizes);
|
win_size_restore(&winsizes);
|
||||||
skip_win_fix_cursor = FALSE;
|
skip_win_fix_cursor = FALSE;
|
||||||
|
|
||||||
|
if (cmdwin_result == K_IGNORE)
|
||||||
|
{
|
||||||
|
// It can be confusing that the cmdwin still shows, redraw the
|
||||||
|
// screen.
|
||||||
|
update_screen(UPD_VALID);
|
||||||
|
set_cmdspos_cursor();
|
||||||
|
redrawcmd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ga_clear(&winsizes);
|
ga_clear(&winsizes);
|
||||||
|
12
src/testdir/dumps/Test_cmdwin_wrong_command_1.dump
Normal file
12
src/testdir/dumps/Test_cmdwin_wrong_command_1.dump
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
| +0&#ffffff0@74
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|[+1#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
|
||||||
|
|:+0#4040ff13&|l+0#af5f00255&>s| +0#0000000&@71
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|[+3#0000000&|C|o|m@1|a|n|d| |L|i|n|e|]| @42|1|,|2| @11|A|l@1
|
||||||
|
|E+0#ffffff16#e000002|1@1|:| |I|n|v|a|l|i|d| |i|n| |c|o|m@1|a|n|d|-|l|i|n|e| |w|i|n|d|o|w|;| |:|q|<|C|R|>| |c|l|o|s|e|s| |t|h|e| |w|i|n|d|o|w| +0#0000000#ffffff0@13
|
12
src/testdir/dumps/Test_cmdwin_wrong_command_2.dump
Normal file
12
src/testdir/dumps/Test_cmdwin_wrong_command_2.dump
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
| +0&#ffffff0@74
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|:+0#0000000&|l|s> @71
|
@@ -73,7 +73,6 @@ func Test_cmdwin_restore()
|
|||||||
call writefile(lines, 'XTest_restore', 'D')
|
call writefile(lines, 'XTest_restore', 'D')
|
||||||
|
|
||||||
let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
|
let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
|
||||||
call TermWait(buf, 50)
|
|
||||||
call term_sendkeys(buf, "q:")
|
call term_sendkeys(buf, "q:")
|
||||||
call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
|
call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
|
||||||
|
|
||||||
@@ -93,11 +92,9 @@ func Test_cmdwin_restore()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_cmdwin_no_terminal()
|
func Test_cmdwin_no_terminal()
|
||||||
CheckFeature terminal
|
CheckScreendump
|
||||||
CheckNotMSWindows
|
|
||||||
|
|
||||||
let buf = RunVimInTerminal('', {'rows': 12})
|
let buf = RunVimInTerminal('', {'rows': 12})
|
||||||
call TermWait(buf, 50)
|
|
||||||
call term_sendkeys(buf, ":set cmdheight=2\<CR>")
|
call term_sendkeys(buf, ":set cmdheight=2\<CR>")
|
||||||
call term_sendkeys(buf, "q:")
|
call term_sendkeys(buf, "q:")
|
||||||
call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\<CR>")
|
call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\<CR>")
|
||||||
@@ -106,6 +103,22 @@ func Test_cmdwin_no_terminal()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cmdwin_wrong_command()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('', {'rows': 12})
|
||||||
|
call term_sendkeys(buf, "q:")
|
||||||
|
call term_sendkeys(buf, "als\<Esc>")
|
||||||
|
call term_sendkeys(buf, "\<C-W>k")
|
||||||
|
call VerifyScreenDump(buf, 'Test_cmdwin_wrong_command_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<C-C>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_cmdwin_wrong_command_2', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":q\<CR>")
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_cmdwin_feedkeys()
|
func Test_cmdwin_feedkeys()
|
||||||
" This should not generate E488
|
" This should not generate E488
|
||||||
call feedkeys("q:\<CR>", 'x')
|
call feedkeys("q:\<CR>", 'x')
|
||||||
|
@@ -699,6 +699,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
500,
|
||||||
/**/
|
/**/
|
||||||
499,
|
499,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user