# HG changeset patch # User Christian Brabandt # Date 1508676305 -7200 # Node ID 42cd1f315e8bc49a5b8a0093c3e1216eb310c761 # Parent f6e4a66dc55fd79f71c760faf02b8d583003b097 patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead commit https://github.com/vim/vim/commit/f8e8c0643b1cd97db11912bc4f773e1328a0da02 Author: Bram Moolenaar Date: Sun Oct 22 14:44:17 2017 +0200 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 #2233) diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -159,6 +159,20 @@ trigger_cmd_autocmd(int typechar, int ev #endif /* + * Abandon the command line. + */ + static void +abandon_cmdline(void) +{ + vim_free(ccline.cmdbuff); + ccline.cmdbuff = NULL; + if (msg_scrolled == 0) + compute_cmdrow(); + MSG(""); + redraw_cmdline = TRUE; +} + +/* * getcmdline() - accept a command line starting with firstc. * * firstc == ':' get ":" command line. @@ -1702,11 +1716,8 @@ getcmdline( if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) { pos_T t; - int search_flags = SEARCH_KEEP + SEARCH_NOOF - + SEARCH_PEEK; - - if (char_avail()) - continue; + int search_flags = SEARCH_KEEP + SEARCH_NOOF; + cursor_off(); out_flush(); if (c == Ctrl_G) @@ -2083,15 +2094,8 @@ returncmd: } #endif - if (gotesc) /* abandon command line */ - { - vim_free(ccline.cmdbuff); - ccline.cmdbuff = NULL; - if (msg_scrolled == 0) - compute_cmdrow(); - MSG(""); - redraw_cmdline = TRUE; - } + if (gotesc) + abandon_cmdline(); } /* diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -356,6 +356,26 @@ func Test_search_cmdline4() bw! endfunc +func Test_search_cmdline5() + if !exists('+incsearch') + return + endif + " Do not call test_override("char_avail", 1) so that and work + " regardless char_avail. + new + call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) + set incsearch + 1 + call feedkeys("/the\\\", 'tx') + call assert_equal(' 3 the third', getline('.')) + $ + call feedkeys("?the\\\\", 'tx') + call assert_equal(' 2 the second', getline('.')) + " clean up + set noincsearch + bw! +endfunc + " Tests for regexp with various magic settings func Test_search_regexp() enew! diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1210, +/**/ 1209, /**/ 1208,