mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
vim-patch:8.1.1475: search string not displayed when 'rightleft' is set
Problem: Search string not displayed when 'rightleft' is set.
Solution: Clear the right part of the old text. (closes vim/vim#4488, closes vim/vim#4489)
db294adc65
This commit is contained in:
@@ -1218,9 +1218,14 @@ int do_search(
|
|||||||
while (*r != NUL && *r == ' ') {
|
while (*r != NUL && *r == ' ') {
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
memmove(msgbuf, r, msgbuf + STRLEN(msgbuf) - r);
|
size_t pat_len = msgbuf + STRLEN(msgbuf) - r;
|
||||||
|
memmove(msgbuf, r, pat_len);
|
||||||
// overwrite old text
|
// overwrite old text
|
||||||
memset(r, ' ', msgbuf + STRLEN(msgbuf) - r);
|
if ((size_t)(r - msgbuf) >= pat_len) {
|
||||||
|
memset(r, ' ', pat_len);
|
||||||
|
} else {
|
||||||
|
memset(msgbuf + pat_len, ' ', r - msgbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
msg_outtrans(msgbuf);
|
msg_outtrans(msgbuf);
|
||||||
msg_clr_eos();
|
msg_clr_eos();
|
||||||
|
@@ -609,3 +609,25 @@ func Test_search_match_at_curpos()
|
|||||||
|
|
||||||
close!
|
close!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_search_display_pattern()
|
||||||
|
new
|
||||||
|
call setline(1, ['foo', 'bar', 'foobar'])
|
||||||
|
|
||||||
|
call cursor(1, 1)
|
||||||
|
let @/ = 'foo'
|
||||||
|
let pat = escape(@/, '()*?'. '\s\+')
|
||||||
|
let g:a = execute(':unsilent :norm! n')
|
||||||
|
call assert_match(pat, g:a)
|
||||||
|
|
||||||
|
" right-left
|
||||||
|
if exists("+rightleft")
|
||||||
|
set rl
|
||||||
|
call cursor(1, 1)
|
||||||
|
let @/ = 'foo'
|
||||||
|
let pat = 'oof/\s\+'
|
||||||
|
let g:a = execute(':unsilent :norm! n')
|
||||||
|
call assert_match(pat, g:a)
|
||||||
|
set norl
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
Reference in New Issue
Block a user