mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
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:
parent
50da4d4f45
commit
83f3218b28
@ -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;
|
||||
|
@ -637,6 +637,12 @@ func Test_incsearch_substitute_dump()
|
||||
call term_sendkeys(buf, "\<BS>")
|
||||
sleep 100m
|
||||
call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {})
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
|
||||
" Reverse range is accepted
|
||||
call term_sendkeys(buf, ':5,2s/foo')
|
||||
sleep 100m
|
||||
call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {})
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
|
Loading…
Reference in New Issue
Block a user