mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Problem: CTRL-G/CTRL-T don't work with incsearch and empty pattern.
Solution: Use the last search pattern. (Christian Brabandt, closes vim/vim#2292)
d048009717
This commit is contained in:
parent
cd59577d57
commit
9bc1410ee1
@ -1019,7 +1019,16 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
|
||||
ui_flush();
|
||||
|
||||
pos_T t;
|
||||
char_u *pat;
|
||||
int search_flags = SEARCH_NOOF;
|
||||
|
||||
|
||||
if (s->firstc == ccline.cmdbuff[0]) {
|
||||
pat = last_search_pattern();
|
||||
} else {
|
||||
pat = ccline.cmdbuff;
|
||||
}
|
||||
|
||||
save_last_search_pattern();
|
||||
|
||||
if (next_match) {
|
||||
@ -1039,7 +1048,7 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
|
||||
emsg_off++;
|
||||
s->i = searchit(curwin, curbuf, &t,
|
||||
next_match ? FORWARD : BACKWARD,
|
||||
ccline.cmdbuff, s->count, search_flags,
|
||||
pat, s->count, search_flags,
|
||||
RE_SEARCH, 0, NULL);
|
||||
emsg_off--;
|
||||
ui_busy_stop();
|
||||
|
@ -335,6 +335,12 @@ restore_last_search_pattern(void)
|
||||
SET_NO_HLSEARCH(saved_no_hlsearch);
|
||||
}
|
||||
|
||||
char_u *
|
||||
last_search_pattern(void)
|
||||
{
|
||||
return spats[RE_SEARCH].pat;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE when case should be ignored for search pattern "pat".
|
||||
* Uses the 'ignorecase' and 'smartcase' options.
|
||||
|
@ -193,7 +193,7 @@ static const int included_patches[] = {
|
||||
// 1307,
|
||||
// 1306,
|
||||
// 1305,
|
||||
// 1304,
|
||||
1304,
|
||||
// 1303,
|
||||
// 1302,
|
||||
// 1301,
|
||||
|
@ -243,6 +243,30 @@ describe('search highlighting', function()
|
||||
{1:~ }|
|
||||
/^ |
|
||||
]])
|
||||
|
||||
-- 8.0.1304, test that C-g and C-t works with incsearch and empty pattern
|
||||
feed('<esc>/fi<CR>')
|
||||
feed('//')
|
||||
screen:expect([[
|
||||
the {3:fi}rst line |
|
||||
in a little {2:fi}le |
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
//^ |
|
||||
]])
|
||||
|
||||
feed('<C-g>')
|
||||
screen:expect([[
|
||||
the {2:fi}rst line |
|
||||
in a little {3:fi}le |
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
//^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('works with incsearch and offset', function()
|
||||
|
Loading…
Reference in New Issue
Block a user