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:
erw7 2019-06-07 09:03:15 +09:00
parent 5263828614
commit 2a4e8a427e
2 changed files with 29 additions and 2 deletions

View File

@ -1218,9 +1218,14 @@ int do_search(
while (*r != NUL && *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
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_clr_eos();

View File

@ -609,3 +609,25 @@ func Test_search_match_at_curpos()
close!
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