mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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 #4488, closes #4489)
This commit is contained in:
@@ -1462,6 +1462,7 @@ do_search(
|
||||
if (curwin->w_p_rl && *curwin->w_p_rlc == 's')
|
||||
{
|
||||
char_u *r;
|
||||
size_t pat_len;
|
||||
|
||||
r = reverse_text(msgbuf);
|
||||
if (r != NULL)
|
||||
@@ -1471,9 +1472,13 @@ do_search(
|
||||
// move reversed text to beginning of buffer
|
||||
while (*r != NUL && *r == ' ')
|
||||
r++;
|
||||
mch_memmove(msgbuf, r, msgbuf + STRLEN(msgbuf) - r);
|
||||
pat_len = msgbuf + STRLEN(msgbuf) - r;
|
||||
mch_memmove(msgbuf, r, pat_len);
|
||||
// overwrite old text
|
||||
vim_memset(r, ' ', msgbuf + STRLEN(msgbuf) - r);
|
||||
if ((size_t)(r - msgbuf) >= pat_len)
|
||||
vim_memset(r, ' ', pat_len);
|
||||
else
|
||||
vim_memset(msgbuf + pat_len, ' ', r - msgbuf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -1289,3 +1289,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
|
||||
|
@@ -767,6 +767,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1475,
|
||||
/**/
|
||||
1474,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user