summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-21 02:30:38 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-21 02:30:38 +0200
commit693f7dc818bc116e997aff5ba8ebc2d555aa41dc (patch)
treee401fd0973f9f77b739fbbb8821fa4413a004bfb
parent405bb4273499a1f59c004cae78bae200e93fa8a7 (diff)
patch 8.1.1577: command line redrawn for +arabic without Arabic charactersv8.1.1577
Problem: Command line redrawn for +arabic without Arabic characters. (Dominique Pelle) Solution: Check if there actually are any Arabic characters. Do redraw after displaying incsearch. (closes #4569)
-rw-r--r--src/ex_getln.c38
-rw-r--r--src/version.c2
2 files changed, 38 insertions, 2 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index c6d22e5fc6..4514540d80 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -450,6 +450,7 @@ may_do_incsearch_highlighting(
#endif
int next_char;
int use_last_pat;
+ int did_do_incsearch = is_state->did_incsearch;
// Parsing range may already set the last search pattern.
// NOTE: must call restore_last_search_pattern() before returning!
@@ -459,6 +460,9 @@ may_do_incsearch_highlighting(
{
restore_last_search_pattern();
finish_incsearch_highlighting(FALSE, is_state, TRUE);
+ if (did_do_incsearch && vpeekc() == NUL)
+ // may have skipped a redraw, do it now
+ redrawcmd();
return;
}
@@ -776,6 +780,35 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state)
}
#endif
+#ifdef FEAT_ARABIC
+/*
+ * Return TRUE if the command line has an Arabic character at or after "start"
+ * for "len" bytes.
+ */
+ static int
+cmdline_has_arabic(int start, int len)
+{
+ int j;
+ int mb_l;
+ int u8c;
+ char_u *p;
+ int u8cc[MAX_MCO];
+
+ if (!enc_utf8)
+ return FALSE;
+
+ for (j = start; j < start + len; j += mb_l)
+ {
+ p = ccline.cmdbuff + j;
+ u8c = utfc_ptr2char_len(p, u8cc, start + len - j);
+ mb_l = utfc_ptr2len_len(p, start + len - j);
+ if (ARABIC_CHAR(u8c))
+ return TRUE;
+ }
+ return FALSE;
+}
+#endif
+
void
cmdline_init(void)
{
@@ -2366,7 +2399,8 @@ cmdline_changed:
#ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl
# ifdef FEAT_ARABIC
- || (p_arshape && !p_tbidi && enc_utf8)
+ || (p_arshape && !p_tbidi
+ && cmdline_has_arabic(0, ccline.cmdlen))
# endif
)
/* Always redraw the whole command line to fix shaping and
@@ -3164,7 +3198,7 @@ draw_cmdline(int start, int len)
else
#endif
#ifdef FEAT_ARABIC
- if (p_arshape && !p_tbidi && enc_utf8 && len > 0)
+ if (p_arshape && !p_tbidi && cmdline_has_arabic(start, len))
{
static int buflen = 0;
char_u *p;
diff --git a/src/version.c b/src/version.c
index ce9e459097..a7dff696db 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1577,
+/**/
1576,
/**/
1575,