mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Problem: When typing a search pattern CTRL-G and CTRL-T are ignored when
there is typeahead.
Solution: Don't pass SEARCH_PEEK and don't call char_avail(). (haya14busa,
closes vim/vim#2233)
f8e8c0643b
This commit is contained in:
parent
2de447b60c
commit
cebf31cf70
@ -443,14 +443,8 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->gotesc) { // abandon command line
|
if (s->gotesc) {
|
||||||
xfree(ccline.cmdbuff);
|
abandon_cmdline();
|
||||||
ccline.cmdbuff = NULL;
|
|
||||||
if (msg_scrolled == 0) {
|
|
||||||
compute_cmdrow();
|
|
||||||
}
|
|
||||||
MSG("");
|
|
||||||
redraw_cmdline = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1680,9 +1674,6 @@ static int command_line_handle_key(CommandLineState *s)
|
|||||||
case Ctrl_G: // next match
|
case Ctrl_G: // next match
|
||||||
case Ctrl_T: // previous match
|
case Ctrl_T: // previous match
|
||||||
if (p_is && !cmd_silent && (s->firstc == '/' || s->firstc == '?')) {
|
if (p_is && !cmd_silent && (s->firstc == '/' || s->firstc == '?')) {
|
||||||
if (char_avail()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (ccline.cmdlen != 0) {
|
if (ccline.cmdlen != 0) {
|
||||||
command_line_next_incsearch(s, s->c == Ctrl_G);
|
command_line_next_incsearch(s, s->c == Ctrl_G);
|
||||||
}
|
}
|
||||||
@ -1948,6 +1939,18 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Abandon the command line.
|
||||||
|
static void abandon_cmdline(void)
|
||||||
|
{
|
||||||
|
xfree(ccline.cmdbuff);
|
||||||
|
ccline.cmdbuff = NULL;
|
||||||
|
if (msg_scrolled == 0) {
|
||||||
|
compute_cmdrow();
|
||||||
|
}
|
||||||
|
MSG("");
|
||||||
|
redraw_cmdline = true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getcmdline() - accept a command line starting with firstc.
|
* getcmdline() - accept a command line starting with firstc.
|
||||||
*
|
*
|
||||||
|
@ -364,6 +364,26 @@ func Test_search_cmdline4()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_search_cmdline5()
|
||||||
|
if !exists('+incsearch')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work
|
||||||
|
" regardless char_avail.
|
||||||
|
new
|
||||||
|
call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
|
||||||
|
set incsearch
|
||||||
|
1
|
||||||
|
call feedkeys("/the\<c-g>\<c-g>\<cr>", 'tx')
|
||||||
|
call assert_equal(' 3 the third', getline('.'))
|
||||||
|
$
|
||||||
|
call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx')
|
||||||
|
call assert_equal(' 2 the second', getline('.'))
|
||||||
|
" clean up
|
||||||
|
set noincsearch
|
||||||
|
bw!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Tests for regexp with various magic settings
|
" Tests for regexp with various magic settings
|
||||||
func Test_search_regexp()
|
func Test_search_regexp()
|
||||||
enew!
|
enew!
|
||||||
|
Loading…
Reference in New Issue
Block a user