mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00:00
vim-patch:8.0.1250
Problem: 'hlsearch' highlighting not removed after incsearch (lacygoill)
Solution: Redraw all windows. Start search at the end of the match. Improve
how CTRL-G works with incremental search. Add tests. (Christian
Brabandt, Hirohito Higashi, haya14busa, closes vim/vim#2267)
f8f8b2eadb
This commit is contained in:
@@ -3306,8 +3306,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Example: >
|
Example: >
|
||||||
augroup vimrc-incsearch-highlight
|
augroup vimrc-incsearch-highlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CmdlineEnter [/\?] :set hlsearch
|
autocmd CmdlineEnter /,\? :set hlsearch
|
||||||
autocmd CmdlineLeave [/\?] :set nohlsearch
|
autocmd CmdlineLeave /,\? :set nohlsearch
|
||||||
augroup END
|
augroup END
|
||||||
<
|
<
|
||||||
CTRL-L can be used to add one character from after the current match
|
CTRL-L can be used to add one character from after the current match
|
||||||
|
@@ -426,7 +426,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||||||
curwin->w_botline = s->old_botline;
|
curwin->w_botline = s->old_botline;
|
||||||
highlight_match = false;
|
highlight_match = false;
|
||||||
validate_cursor(); // needed for TAB
|
validate_cursor(); // needed for TAB
|
||||||
redraw_later(SOME_VALID);
|
redraw_all_later(SOME_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ccline.cmdbuff != NULL) {
|
if (ccline.cmdbuff != NULL) {
|
||||||
@@ -1024,6 +1024,11 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
|
|||||||
|
|
||||||
if (next_match) {
|
if (next_match) {
|
||||||
t = s->match_end;
|
t = s->match_end;
|
||||||
|
if (lt(s->match_start, s->match_end)) {
|
||||||
|
// start searching at the end of the match
|
||||||
|
// not at the beginning of the next column
|
||||||
|
(void)decl(&t);
|
||||||
|
}
|
||||||
search_flags += SEARCH_COL;
|
search_flags += SEARCH_COL;
|
||||||
} else {
|
} else {
|
||||||
t = s->match_start;
|
t = s->match_start;
|
||||||
@@ -1662,7 +1667,9 @@ static int command_line_handle_key(CommandLineState *s)
|
|||||||
if (char_avail()) {
|
if (char_avail()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
command_line_next_incsearch(s, s->c == Ctrl_G);
|
if (ccline.cmdlen != 0) {
|
||||||
|
command_line_next_incsearch(s, s->c == Ctrl_G);
|
||||||
|
}
|
||||||
return command_line_not_changed(s);
|
return command_line_not_changed(s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1785,6 +1792,7 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
if (ccline.cmdlen == 0) {
|
if (ccline.cmdlen == 0) {
|
||||||
s->i = 0;
|
s->i = 0;
|
||||||
SET_NO_HLSEARCH(true); // turn off previous highlight
|
SET_NO_HLSEARCH(true); // turn off previous highlight
|
||||||
|
redraw_all_later(SOME_VALID);
|
||||||
} else {
|
} else {
|
||||||
int search_flags = SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK;
|
int search_flags = SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK;
|
||||||
ui_busy_start();
|
ui_busy_start();
|
||||||
|
Reference in New Issue
Block a user