0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.1.0494: Wrong matched text highlighted in pum with 'rightleft'

Problem:  Wrong matched text highlighted in pum with 'rightleft'.
Solution: Match using the original text instead of the reversed text.
          (zeertzjq)

closes: #15020

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq 2024-06-16 16:51:25 +02:00 committed by Christian Brabandt
parent 917ff8a19d
commit 63901e8963
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
11 changed files with 196 additions and 69 deletions

View File

@ -421,46 +421,43 @@ pum_under_menu(int row, int col, int only_redrawing)
} }
/* /*
* displays text on the popup menu with specific attributes. * Computes attributes of text on the popup menu.
* Returns attributes for every cell, or NULL if all attributes are the same.
*/ */
static void static int *
pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf) pum_compute_text_attrs(char_u *text, hlf_T hlf)
{ {
int i; int i;
int leader_len; int leader_len;
int char_len; int char_cells;
int cells;
int new_attr; int new_attr;
char_u *rt_leader = NULL;
char_u *match_leader = NULL;
char_u *ptr = text; char_u *ptr = text;
int cell_idx = 0;
garray_T *ga = NULL; garray_T *ga = NULL;
int *attrs = NULL;
char_u *leader = ins_compl_leader(); char_u *leader = ins_compl_leader();
int in_fuzzy = (get_cot_flags() & COT_FUZZY) != 0; int in_fuzzy = (get_cot_flags() & COT_FUZZY) != 0;
int matched_start = FALSE;
int_u char_pos = 0;
if (leader == NULL || *leader == NUL || (hlf != HLF_PSI && hlf != HLF_PNI) if (leader == NULL || *leader == NUL || (hlf != HLF_PSI && hlf != HLF_PNI)
|| (highlight_attr[HLF_PMSI] == highlight_attr[HLF_PSI] || (highlight_attr[HLF_PMSI] == highlight_attr[HLF_PSI]
&& highlight_attr[HLF_PMNI] == highlight_attr[HLF_PNI])) && highlight_attr[HLF_PMNI] == highlight_attr[HLF_PNI]))
{ return NULL;
screen_puts_len(text, textlen, row, col, highlight_attr[hlf]);
return;
}
#ifdef FEAT_RIGHTLEFT attrs = ALLOC_MULT(int, vim_strsize(text));
if (pum_rl) if (attrs == NULL)
rt_leader = reverse_text(leader); return NULL;
#endif
match_leader = rt_leader != NULL ? rt_leader : leader; leader_len = (int)STRLEN(leader);
leader_len = (int)STRLEN(match_leader);
if (in_fuzzy) if (in_fuzzy)
ga = fuzzy_match_str_with_pos(text, match_leader); ga = fuzzy_match_str_with_pos(text, leader);
else
matched_start = STRNCMP(text, leader, leader_len) == 0;
// Render text with proper attributes while (*ptr != NUL)
while (*ptr != NUL && ptr < text + textlen)
{ {
char_len = mb_ptr2len(ptr);
cells = mb_ptr2cells(ptr);
new_attr = highlight_attr[hlf]; new_attr = highlight_attr[hlf];
if (ga != NULL) if (ga != NULL)
@ -468,15 +465,7 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
// Handle fuzzy matching // Handle fuzzy matching
for (i = 0; i < ga->ga_len; i++) for (i = 0; i < ga->ga_len; i++)
{ {
int_u *match_pos = ((int_u *)ga->ga_data) + i; if (char_pos == ((int_u *)ga->ga_data)[i])
int_u actual_char_pos = 0;
char_u *temp_ptr = text;
while (temp_ptr < ptr)
{
temp_ptr += mb_ptr2len(temp_ptr);
actual_char_pos++;
}
if (actual_char_pos == match_pos[0])
{ {
new_attr = highlight_attr[hlf == HLF_PSI new_attr = highlight_attr[hlf == HLF_PSI
? HLF_PMSI : HLF_PMNI]; ? HLF_PMSI : HLF_PMNI];
@ -484,13 +473,16 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
} }
} }
} }
else if (!in_fuzzy && (ptr - text < leader_len) else if (matched_start && ptr < text + leader_len)
&& (STRNCMP(text, match_leader, leader_len) == 0))
new_attr = highlight_attr[hlf == HLF_PSI ? HLF_PMSI : HLF_PMNI]; new_attr = highlight_attr[hlf == HLF_PSI ? HLF_PMSI : HLF_PMNI];
screen_puts_len(ptr, char_len, row, col, new_attr); char_cells = mb_ptr2cells(ptr);
col += cells; for (i = 0; i < char_cells; i++)
ptr += char_len; attrs[cell_idx + i] = new_attr;
cell_idx += char_cells;
MB_PTR_ADV(ptr);
char_pos++;
} }
if (ga != NULL) if (ga != NULL)
@ -498,8 +490,40 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
ga_clear(ga); ga_clear(ga);
vim_free(ga); vim_free(ga);
} }
if (rt_leader) return attrs;
vim_free(rt_leader); }
/*
* Displays text on the popup menu with specific attributes.
*/
static void
pum_screen_puts_with_attrs(
int row,
int col,
int cells UNUSED,
char_u *text,
int textlen,
int *attrs)
{
int col_start = col;
char_u *ptr = text;
int char_len;
int attr;
// Render text with proper attributes
while (*ptr != NUL && ptr < text + textlen)
{
char_len = mb_ptr2len(ptr);
#ifdef FEAT_RIGHTLEFT
if (pum_rl)
attr = attrs[col_start + cells - col - 1];
else
#endif
attr = attrs[col - col_start];
screen_puts_len(ptr, char_len, row, col, attr);
col += mb_ptr2cells(ptr);
ptr += char_len;
}
} }
/* /*
@ -616,6 +640,7 @@ pum_redraw(void)
// Display the text that fits or comes before a Tab. // Display the text that fits or comes before a Tab.
// First convert it to printable characters. // First convert it to printable characters.
char_u *st; char_u *st;
int *attrs;
int saved = *p; int saved = *p;
if (saved != NUL) if (saved != NUL)
@ -623,6 +648,9 @@ pum_redraw(void)
st = transstr(s); st = transstr(s);
if (saved != NUL) if (saved != NUL)
*p = saved; *p = saved;
attrs = pum_compute_text_attrs(st, hlf);
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (pum_rl) if (pum_rl)
{ {
@ -633,19 +661,19 @@ pum_redraw(void)
if (rt != NULL) if (rt != NULL)
{ {
char_u *rt_start = rt; char_u *rt_start = rt;
int size; int cells;
size = vim_strsize(rt); cells = vim_strsize(rt);
if (size > pum_width) if (cells > pum_width)
{ {
do do
{ {
size -= has_mbyte cells -= has_mbyte
? (*mb_ptr2cells)(rt) : 1; ? (*mb_ptr2cells)(rt) : 1;
MB_PTR_ADV(rt); MB_PTR_ADV(rt);
} while (size > pum_width); } while (cells > pum_width);
if (size < pum_width) if (cells < pum_width)
{ {
// Most left character requires // Most left character requires
// 2-cells but only 1 cell is // 2-cells but only 1 cell is
@ -653,10 +681,18 @@ pum_redraw(void)
// '<' on the left of the pum // '<' on the left of the pum
// item // item
*(--rt) = '<'; *(--rt) = '<';
size++; cells++;
} }
} }
pum_screen_put_with_attr(row, col - size + 1, rt, (int)STRLEN(rt), hlf);
if (attrs == NULL)
screen_puts_len(rt, (int)STRLEN(rt),
row, col - cells + 1, attr);
else
pum_screen_puts_with_attrs(row,
col - cells + 1, cells, rt,
(int)STRLEN(rt), attrs);
vim_free(rt_start); vim_free(rt_start);
} }
vim_free(st); vim_free(st);
@ -684,12 +720,20 @@ pum_redraw(void)
else else
--cells; --cells;
} }
pum_screen_put_with_attr(row, col, st, size, hlf);
if (attrs == NULL)
screen_puts_len(st, size, row, col, attr);
else
pum_screen_puts_with_attrs(row, col, cells,
st, size, attrs);
vim_free(st); vim_free(st);
} }
col += width; col += width;
} }
vim_free(attrs);
if (*p != TAB) if (*p != TAB)
break; break;

View File

@ -1,5 +1,6 @@
|f+0&#ffffff0|o> @72 |f+0&#ffffff0|o> @72
|f+0#00e0e07#ffd7ff255|o|o+0#0000001#e0e0e08| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#00e0e07#e0e0e08|o|o+0#0000001&| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|f|o@1| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
@ -16,5 +17,4 @@
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |8| +0#0000000&@34

View File

@ -1,5 +1,5 @@
|你*0&#ffffff0> +&@72 |你*0&#ffffff0> +&@72
|你*0#00e0e07#ffd7ff255|好*0#0000001#e0e0e08| +&@10| +0#4040ff13#ffffff0@59 |你*0#00e0e07#e0e0e08|好*0#0000001&| +&@10| +0#4040ff13#ffffff0@59
|你*0#0000e05#ffd7ff255|好*0#0000001&|吗| +&@8| +0#4040ff13#ffffff0@59 |你*0#0000e05#ffd7ff255|好*0#0000001&|吗| +&@8| +0#4040ff13#ffffff0@59
|你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59 |你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59
|你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59 |你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59
@ -17,4 +17,4 @@
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |~| @73
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |8| +0#0000000&@34 |-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34

View File

@ -1,5 +1,5 @@
|你*0&#ffffff0|吗> +&@70 |你*0&#ffffff0|吗> +&@70
|你*0#00e0e07#ffd7ff255|好*0#0000001#e0e0e08|吗*0#00e0e07#ffd7ff255| +0#0000001#e0e0e08@8| +0#4040ff13#ffffff0@59 |你*0#00e0e07#e0e0e08|好*0#0000001&|吗*0#00e0e07&| +0#0000001&@8| +0#4040ff13#ffffff0@59
|你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59 |你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59
|你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59 |你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59
|~| @73 |~| @73
@ -17,4 +17,4 @@
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |~| @73
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |8| +0#0000000&@34 |-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34

View File

@ -1,5 +1,6 @@
| +0&#ffffff0@70|o>f|o|f | +0&#ffffff0@71> |o|f
| +0#4040ff13&@58| +0#0000001#e0e0e08|d|n|i|k|o@1|f| @4|o|o+0#00e0e07#ffd7ff255|f | +0#4040ff13&@58| +0#0000001#e0e0e08|d|n|i|k|o@1|f| @4|o|o+0#00e0e07&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|o@1|f|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|r|a|b|o|o+0#0000e05&|f | +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|r|a|b|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|z|a|B|o|o+0#0000e05&|f | +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|z|a|B|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| |a|l|a|b|o|o+0#0000e05&|f | +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| |a|l|a|b|o|o+0#0000e05&|f
@ -16,5 +17,4 @@
| @73|~ | @73|~
| @73|~ | @73|~
| @73|~ | @73|~
| @73|~ |-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |8| +0#0000000&@34

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@71> |你*&
| +0#4040ff13&@59| +0#0000001#e0e0e08@10|好*&|你*0#00e0e07&
| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@8|吗*&|好|你*0#0000e05&
| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*&|好|不|你*0#0000e05&
| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*&|好|可|你*0#0000e05&
| +0#4040ff13#ffffff0@73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@69> |吗*&|你
| +0#4040ff13&@59| +0#0000001#e0e0e08@8|吗*0#00e0e07&|好*0#0000001&|你*0#00e0e07&
| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*0#0000e05&|好*0#0000001&|不|你*0#0000e05&
| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*0#0000e05&|好*0#0000001&|可|你*0#0000e05&
| +0#4040ff13#ffffff0@73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34

View File

@ -1,5 +1,6 @@
|f+0&#ffffff0|o> @72 |f+0&#ffffff0|o> @72
|f+0#00e0e07#ffd7ff255|o|o+0#0000001#e0e0e08| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#00e0e07#e0e0e08|o|o+0#0000001&| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|f|o@1| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58 |f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
@ -16,5 +17,4 @@
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |~| @73
|~| @73 |-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |8| +0#0000000&@34

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@71> |o|f
| +0#4040ff13&@58| +0#0000001#e0e0e08|d|n|i|k|o@1|f| @4|o|o+0#00e0e07&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|o@1|f|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|r|a|b|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|z|a|B|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| |a|l|a|b|o|o+0#0000e05&|f
| +0#4040ff13#ffffff0@73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
| @73|~
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34

View File

@ -1390,6 +1390,7 @@ func Test_pum_highlights_match()
return { return {
\ 'words': [ \ 'words': [
\ { 'word': 'foo', 'kind': 'fookind' }, \ { 'word': 'foo', 'kind': 'fookind' },
\ { 'word': 'foofoo', 'kind': 'fookind' },
\ { 'word': 'foobar', 'kind': 'fookind' }, \ { 'word': 'foobar', 'kind': 'fookind' },
\ { 'word': 'fooBaz', 'kind': 'fookind' }, \ { 'word': 'fooBaz', 'kind': 'fookind' },
\ { 'word': 'foobala', 'kind': 'fookind' }, \ { 'word': 'foobala', 'kind': 'fookind' },
@ -1401,7 +1402,7 @@ func Test_pum_highlights_match()
endfunc endfunc
set omnifunc=Omni_test set omnifunc=Omni_test
set completeopt=menu,noinsert,fuzzy set completeopt=menu,noinsert,fuzzy
hi PmenuMatchSel ctermfg=6 ctermbg=225 hi PmenuMatchSel ctermfg=6 ctermbg=7
hi PmenuMatch ctermfg=4 ctermbg=225 hi PmenuMatch ctermfg=4 ctermbg=225
END END
call writefile(lines, 'Xscript', 'D') call writefile(lines, 'Xscript', 'D')
@ -1412,7 +1413,7 @@ func Test_pum_highlights_match()
call term_sendkeys(buf, "fo") call term_sendkeys(buf, "fo")
call TermWait(buf, 50) call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_03', {}) call VerifyScreenDump(buf, 'Test_pum_highlights_03', {})
call term_sendkeys(buf, "\<ESC>S\<C-x>\<C-O>") call term_sendkeys(buf, "\<Esc>S\<C-X>\<C-O>")
call TermWait(buf, 50) call TermWait(buf, 50)
call term_sendkeys(buf, "你") call term_sendkeys(buf, "你")
call TermWait(buf, 50) call TermWait(buf, 50)
@ -1420,28 +1421,48 @@ func Test_pum_highlights_match()
call term_sendkeys(buf, "吗") call term_sendkeys(buf, "吗")
call TermWait(buf, 50) call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_05', {}) call VerifyScreenDump(buf, 'Test_pum_highlights_05', {})
call term_sendkeys(buf, "\<C-E>\<Esc>")
if has('rightleft') if has('rightleft')
call term_sendkeys(buf, "\<C-E>\<ESC>u:set rightleft\<CR>") call term_sendkeys(buf, ":set rightleft\<CR>")
call TermWait(buf, 50) call TermWait(buf, 50)
call term_sendkeys(buf, "i\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call TermWait(buf, 50) call TermWait(buf, 50)
call term_sendkeys(buf, "fo") call term_sendkeys(buf, "fo")
call TermWait(buf, 50) call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_06', {}) call VerifyScreenDump(buf, 'Test_pum_highlights_06', {})
call term_sendkeys(buf, "\<C-E>\<ESC>u:set norightleft\<CR>") call term_sendkeys(buf, "\<Esc>S\<C-X>\<C-O>")
call TermWait(buf, 50)
call term_sendkeys(buf, "你")
call VerifyScreenDump(buf, 'Test_pum_highlights_06a', {})
call term_sendkeys(buf, "吗")
call VerifyScreenDump(buf, 'Test_pum_highlights_06b', {})
call term_sendkeys(buf, "\<C-E>\<Esc>")
call term_sendkeys(buf, ":set norightleft\<CR>")
call TermWait(buf) call TermWait(buf)
endif endif
call term_sendkeys(buf, ":set completeopt-=fuzzy\<CR>") call term_sendkeys(buf, ":set completeopt-=fuzzy\<CR>")
call TermWait(buf) call TermWait(buf)
call term_sendkeys(buf, "\<ESC>S\<C-x>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call TermWait(buf, 50) call TermWait(buf, 50)
call term_sendkeys(buf, "fo") call term_sendkeys(buf, "fo")
call TermWait(buf, 50) call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_07', {}) call VerifyScreenDump(buf, 'Test_pum_highlights_07', {})
call term_sendkeys(buf, "\<C-E>\<Esc>")
if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call TermWait(buf, 50)
call term_sendkeys(buf, "fo")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_08', {})
call term_sendkeys(buf, "\<C-E>\<Esc>")
call term_sendkeys(buf, ":set norightleft\<CR>")
endif
call term_sendkeys(buf, "\<C-E>\<Esc>u")
call TermWait(buf) call TermWait(buf)
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc

View File

@ -704,6 +704,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 */
/**/
494,
/**/ /**/
493, 493,
/**/ /**/