aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2017-11-03 08:28:36 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2018-01-26 18:39:20 +0300
commitcd973be11bfcdee286017f83e04c3d6c3be2f19a (patch)
tree23d15499d1864efec77bfcb9687e9034ea6452dc
parent41394d82365b504c89bb4da9ed5adc11c6f619f0 (diff)
downloadrneovim-cd973be11bfcdee286017f83e04c3d6c3be2f19a.tar.gz
rneovim-cd973be11bfcdee286017f83e04c3d6c3be2f19a.tar.bz2
rneovim-cd973be11bfcdee286017f83e04c3d6c3be2f19a.zip
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) https://github.com/vim/vim/commit/f8f8b2eadbaf3090fcfccbab560de5dbd501833d
-rw-r--r--runtime/doc/options.txt4
-rw-r--r--src/nvim/ex_getln.c12
2 files changed, 12 insertions, 4 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2e584ea9bb..6a36202177 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3306,8 +3306,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Example: >
augroup vimrc-incsearch-highlight
autocmd!
- autocmd CmdlineEnter [/\?] :set hlsearch
- autocmd CmdlineLeave [/\?] :set nohlsearch
+ autocmd CmdlineEnter /,\? :set hlsearch
+ autocmd CmdlineLeave /,\? :set nohlsearch
augroup END
<
CTRL-L can be used to add one character from after the current match
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 81c6854459..692a8893ae 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -426,7 +426,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
curwin->w_botline = s->old_botline;
highlight_match = false;
validate_cursor(); // needed for TAB
- redraw_later(SOME_VALID);
+ redraw_all_later(SOME_VALID);
}
if (ccline.cmdbuff != NULL) {
@@ -1024,6 +1024,11 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
if (next_match) {
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;
} else {
t = s->match_start;
@@ -1662,7 +1667,9 @@ static int command_line_handle_key(CommandLineState *s)
if (char_avail()) {
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);
}
break;
@@ -1785,6 +1792,7 @@ static int command_line_changed(CommandLineState *s)
if (ccline.cmdlen == 0) {
s->i = 0;
SET_NO_HLSEARCH(true); // turn off previous highlight
+ redraw_all_later(SOME_VALID);
} else {
int search_flags = SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK;
ui_busy_start();