Skip to content

Instantly share code, notes, and snippets.

@presuku
Last active August 29, 2015 14:10
Show Gist options
  • Save presuku/a42e19b17268e4a2149b to your computer and use it in GitHub Desktop.
Save presuku/a42e19b17268e4a2149b to your computer and use it in GitHub Desktop.
diff -r 24b8a839fa25 src/screen.c
--- a/src/screen.c Sun Dec 07 00:04:48 2014 +0900
+++ b/src/screen.c Sun Dec 07 01:00:02 2014 +0900
@@ -2919,6 +2919,7 @@
int mb_c = 0; /* decoded multi-byte character */
int mb_utf8 = FALSE; /* screen char is UTF-8 char */
int u8cc[MAX_MCO]; /* composing UTF-8 chars */
+ int hl_len = 0;
#endif
#ifdef FEAT_DIFF
int filler_lines; /* nr of filler lines to be drawn */
@@ -3854,6 +3855,10 @@
* priority).
*/
v = (long)(ptr - line);
+#ifdef FEAT_MBYTE
+ if (has_mbyte)
+ hl_len += (*mb_ptr2len)(ptr);
+#endif
cur = wp->w_match_head;
shl_flag = FALSE;
while (cur != NULL || shl_flag == FALSE)
@@ -3879,10 +3884,17 @@
&& v < (long)shl->endcol)
{
shl->attr_cur = shl->attr;
+#ifdef FEAT_MBYTE
+ if (has_mbyte && shl->endcol < hl_len)
+ shl->endcol = hl_len;
+#endif
}
- else if (v >= (long)shl->endcol && shl->lnum == lnum)
+ else if (v == (long)shl->endcol)
{
shl->attr_cur = 0;
+#ifdef FEAT_MBYTE
+ hl_len = 0;
+#endif
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
pos_inprogress = cur == NULL || cur->pos.cur == 0
? FALSE : TRUE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment