mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
vim-patch:9.1.1612: Ctrl-G/Ctrl-T do not ignore the end search delimiter
Problem: Ctrl-G/Ctrl-T does not ignore the end search delimiter
(irisjae)
Solution: Check if the pattern ends with a search delimiter and ignore
it, unless it is part of the pattern.
fixes: vim/vim#17895
closes: vim/vim#17933
c03990d30f
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -1543,6 +1543,17 @@ static int may_do_command_line_next_incsearch(int firstc, int count, incsearch_s
|
||||
pat = ccline.cmdbuff + skiplen;
|
||||
}
|
||||
|
||||
bool bslsh = false;
|
||||
// do not search for the search end delimiter,
|
||||
// unless it is part of the pattern
|
||||
if (patlen > 2 && firstc == pat[patlen - 1]) {
|
||||
patlen--;
|
||||
if (pat[patlen - 1] == '\\') {
|
||||
pat[patlen - 1] = (char)(uint8_t)firstc;
|
||||
bslsh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (next_match) {
|
||||
t = s->match_end;
|
||||
if (lt(s->match_start, s->match_end)) {
|
||||
@@ -1566,6 +1577,9 @@ static int may_do_command_line_next_incsearch(int firstc, int count, incsearch_s
|
||||
RE_SEARCH, NULL);
|
||||
emsg_off--;
|
||||
pat[patlen] = save;
|
||||
if (bslsh) {
|
||||
pat[patlen - 1] = '\\';
|
||||
}
|
||||
ui_busy_stop();
|
||||
if (found) {
|
||||
s->search_start = s->match_start;
|
||||
|
Reference in New Issue
Block a user