0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -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:
Bram Moolenaar
2019-06-06 12:49:29 +02:00
parent 9aeb33639f
commit db294adc65
3 changed files with 31 additions and 2 deletions

View File

@@ -1462,6 +1462,7 @@ do_search(
if (curwin->w_p_rl && *curwin->w_p_rlc == 's') if (curwin->w_p_rl && *curwin->w_p_rlc == 's')
{ {
char_u *r; char_u *r;
size_t pat_len;
r = reverse_text(msgbuf); r = reverse_text(msgbuf);
if (r != NULL) if (r != NULL)
@@ -1471,9 +1472,13 @@ do_search(
// move reversed text to beginning of buffer // move reversed text to beginning of buffer
while (*r != NUL && *r == ' ') while (*r != NUL && *r == ' ')
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 // 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 #endif

View File

@@ -1289,3 +1289,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

View File

@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1475,
/**/ /**/
1474, 1474,
/**/ /**/