vim-patch:8.1.0278: 'incsearch' highlighting does not accept reverse range

Problem:    'incsearch' highlighting does not accept reverse range.
Solution:   Swap the range when needed. (issue vim/vim#3321)
60d0871000
This commit is contained in:
Aufar Gilbran
2020-08-11 00:47:50 +08:00
parent 50da4d4f45
commit 83f3218b28
2 changed files with 14 additions and 2 deletions

View File

@@ -319,8 +319,14 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
curwin->w_cursor = s->search_start;
parse_cmd_address(&ea, &dummy);
if (ea.addr_count > 0) {
search_first_line = ea.line1;
search_last_line = ea.line2;
// Allow for reverse match.
if (ea.line2 < ea.line1) {
search_first_line = ea.line2;
search_last_line = ea.line1;
} else {
search_first_line = ea.line1;
search_last_line = ea.line2;
}
} else if (*cmd == 's') {
// :s defaults to the current line
search_first_line = curwin->w_cursor.lnum;