Hi, Fixed the display of listchars characters on the cursorline & visual-mode. I've created a patch of two patterns. I should not be judged because it is personal preference.
SpecialKey_overrides_CursorLine.patch -> Every highlighting listchars chatscters. CursorLine_overrides_SpecialKey.patch -> Easy to use because it is similar to the current version. comparison.png -> Please refer. It is a comparison image in the following settings. :colorscheme delek :set cursorline list listchars=eol:$,tab:>-,trail:~,nbsp:% I prefer the CursorLine_overrides_SpecialKey.patch version. Best regards, DeaR -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
diff -r c61da758a9a2 src/screen.c
--- a/src/screen.c Wed Apr 24 18:34:45 2013 +0200
+++ b/src/screen.c Sat Apr 27 14:47:15 2013 +0900
@@ -3941,12 +3941,9 @@
mb_utf8 = (c >= 0x80);
n_extra = (int)STRLEN(p_extra);
c_extra = NUL;
- if (area_attr == 0 && search_attr == 0)
- {
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
}
else if (mb_l == 0) /* at the NUL at end-of-line */
mb_l = 1;
@@ -4073,26 +4070,258 @@
) && lcs_nbsp)
{
c = lcs_nbsp;
- if (area_attr == 0 && search_attr == 0)
- {
+ n_attr = 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE;
+#endif
+ }
+
+ if (extra_check)
+ {
+#ifdef FEAT_LINEBREAK
+ /*
+ * Found last space before word: check for line break.
+ */
+ if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
+ && !wp->w_p_list)
+ {
+ n_extra = win_lbr_chartabsize(wp, ptr - (
+# ifdef FEAT_MBYTE
+ has_mbyte ? mb_l :
+# endif
+ 1), (colnr_T)vcol, NULL) - 1;
+ c_extra = ' ';
+ if (vim_iswhite(c))
+ c = ' ';
+ }
+#endif
+
+ if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
+ {
+ c = lcs_trail;
n_attr = 1;
extra_attr = hl_attr(HLF_8);
saved_attr2 = char_attr; /* save current attr */
- }
#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE;
-#endif
- }
-
- if (extra_check)
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE;
+#endif
+ }
+ }
+
+ /*
+ * Handling of non-printable characters.
+ */
+ if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
+ {
+ /*
+ * when getting a character from the file, we may have to
+ * turn it into something else on the way to putting it
+ * into "ScreenLines".
+ */
+ if (c == TAB && (!wp->w_p_list || lcs_tab1))
+ {
+ /* tab amount depends on current column */
+ n_extra = (int)wp->w_buffer->b_p_ts
+ - vcol % (int)wp->w_buffer->b_p_ts - 1;
+#ifdef FEAT_CONCEAL
+ /* Tab alignment should be identical regardless of
+ * 'conceallevel' value. So tab compensates of all
+ * previous concealed characters, and thus resets vcol_off
+ * and boguscols accumulated so far in the line. Note that
+ * the tab can be longer than 'tabstop' when there
+ * are concealed characters. */
+ n_extra += vcol_off;
+ vcol -= vcol_off;
+ vcol_off = 0;
+ col -= boguscols;
+ boguscols = 0;
+#endif
+#ifdef FEAT_MBYTE
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ if (wp->w_p_list)
+ {
+ c = lcs_tab1;
+ c_extra = lcs_tab2;
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+#endif
+ }
+ else
+ {
+ c_extra = ' ';
+ c = ' ';
+ }
+ }
+ else if (c == NUL
+ && ((wp->w_p_list && lcs_eol > 0)
+ || ((fromcol >= 0 || fromcol_prev >= 0)
+ && tocol > vcol
+#ifdef FEAT_VISUAL
+ && VIsual_mode != Ctrl_V
+#endif
+ && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col < W_WIDTH(wp)))
+ && !(noinvcur
+ && lnum == wp->w_cursor.lnum
+ && (colnr_T)vcol == wp->w_virtcol)))
+ && lcs_eol_one >= 0)
+ {
+ /* Display a '$' after the line or highlight an extra
+ * character if the line break is included. */
+#if defined(FEAT_DIFF) || defined(LINE_ATTR)
+ /* For a diff line the highlighting continues after the
+ * "$". */
+ if (
+# ifdef FEAT_DIFF
+ diff_hlf == (hlf_T)0
+# ifdef LINE_ATTR
+ &&
+# endif
+# endif
+# ifdef LINE_ATTR
+ line_attr == 0
+# endif
+ )
+#endif
+ {
+#ifdef FEAT_VIRTUALEDIT
+ /* In virtualedit, visual selections may extend
+ * beyond end of line. */
+ if (area_highlighting && virtual_active()
+ && tocol != MAXCOL && vcol < tocol)
+ n_extra = 0;
+ else
+#endif
+ {
+ p_extra = at_end_str;
+ n_extra = 1;
+ c_extra = NUL;
+ }
+ }
+ if (wp->w_p_list)
+ c = lcs_eol;
+ else
+ c = ' ';
+ lcs_eol_one = -1;
+ --ptr; /* put it back at the NUL */
+ extra_attr = hl_attr(HLF_AT);
+ n_attr = 1;
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ }
+ else if (c != NUL)
+ {
+ p_extra = transchar(c);
+#ifdef FEAT_RIGHTLEFT
+ if ((dy_flags & DY_UHEX) && wp->w_p_rl)
+ rl_mirror(p_extra); /* reverse "<12>" */
+#endif
+ n_extra = byte2cells(c) - 1;
+ c_extra = NUL;
+ c = *p_extra++;
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ }
+#ifdef FEAT_VIRTUALEDIT
+ else if (VIsual_active
+ && (VIsual_mode == Ctrl_V
+ || VIsual_mode == 'v')
+ && virtual_active()
+ && tocol != MAXCOL
+ && vcol < tocol
+ && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col < W_WIDTH(wp))))
+ {
+ c = ' ';
+ --ptr; /* put it back at the NUL */
+ }
+#endif
+#if defined(LINE_ATTR)
+ else if ((
+# ifdef FEAT_DIFF
+ diff_hlf != (hlf_T)0 ||
+# endif
+ line_attr != 0
+ ) && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col
+# ifdef FEAT_CONCEAL
+ - boguscols
+# endif
+ < W_WIDTH(wp))))
+ {
+ /* Highlight until the right side of the window */
+ c = ' ';
+ --ptr; /* put it back at the NUL */
+
+ /* Remember we do the char for line highlighting. */
+ ++did_line_attr;
+
+ /* don't do search HL for the rest of the line */
+ if (line_attr != 0 && char_attr == search_attr && col > 0)
+ char_attr = line_attr;
+# ifdef FEAT_DIFF
+ if (diff_hlf == HLF_TXD)
+ {
+ diff_hlf = HLF_CHD;
+ if (attr == 0 || char_attr != attr)
+ char_attr = hl_attr(diff_hlf);
+ }
+# endif
+ }
+#endif
+ }
+
+ if (extra_check && n_attr == 0)
{
#ifdef FEAT_SPELL
int can_spell = TRUE;
@@ -4236,246 +4465,6 @@
char_attr = hl_combine_attr(spell_attr, char_attr);
}
#endif
-#ifdef FEAT_LINEBREAK
- /*
- * Found last space before word: check for line break.
- */
- if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
- && !wp->w_p_list)
- {
- n_extra = win_lbr_chartabsize(wp, ptr - (
-# ifdef FEAT_MBYTE
- has_mbyte ? mb_l :
-# endif
- 1), (colnr_T)vcol, NULL) - 1;
- c_extra = ' ';
- if (vim_iswhite(c))
- c = ' ';
- }
-#endif
-
- if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
- {
- c = lcs_trail;
- if (!attr_pri)
- {
- n_attr = 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE;
-#endif
- }
- }
-
- /*
- * Handling of non-printable characters.
- */
- if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
- {
- /*
- * when getting a character from the file, we may have to
- * turn it into something else on the way to putting it
- * into "ScreenLines".
- */
- if (c == TAB && (!wp->w_p_list || lcs_tab1))
- {
- /* tab amount depends on current column */
- n_extra = (int)wp->w_buffer->b_p_ts
- - vcol % (int)wp->w_buffer->b_p_ts - 1;
-#ifdef FEAT_CONCEAL
- /* Tab alignment should be identical regardless of
- * 'conceallevel' value. So tab compensates of all
- * previous concealed characters, and thus resets vcol_off
- * and boguscols accumulated so far in the line. Note that
- * the tab can be longer than 'tabstop' when there
- * are concealed characters. */
- n_extra += vcol_off;
- vcol -= vcol_off;
- vcol_off = 0;
- col -= boguscols;
- boguscols = 0;
-#endif
-#ifdef FEAT_MBYTE
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- if (wp->w_p_list)
- {
- c = lcs_tab1;
- c_extra = lcs_tab2;
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
-#endif
- }
- else
- {
- c_extra = ' ';
- c = ' ';
- }
- }
- else if (c == NUL
- && ((wp->w_p_list && lcs_eol > 0)
- || ((fromcol >= 0 || fromcol_prev >= 0)
- && tocol > vcol
-#ifdef FEAT_VISUAL
- && VIsual_mode != Ctrl_V
-#endif
- && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col < W_WIDTH(wp)))
- && !(noinvcur
- && lnum == wp->w_cursor.lnum
- && (colnr_T)vcol == wp->w_virtcol)))
- && lcs_eol_one >= 0)
- {
- /* Display a '$' after the line or highlight an extra
- * character if the line break is included. */
-#if defined(FEAT_DIFF) || defined(LINE_ATTR)
- /* For a diff line the highlighting continues after the
- * "$". */
- if (
-# ifdef FEAT_DIFF
- diff_hlf == (hlf_T)0
-# ifdef LINE_ATTR
- &&
-# endif
-# endif
-# ifdef LINE_ATTR
- line_attr == 0
-# endif
- )
-#endif
- {
-#ifdef FEAT_VIRTUALEDIT
- /* In virtualedit, visual selections may extend
- * beyond end of line. */
- if (area_highlighting && virtual_active()
- && tocol != MAXCOL && vcol < tocol)
- n_extra = 0;
- else
-#endif
- {
- p_extra = at_end_str;
- n_extra = 1;
- c_extra = NUL;
- }
- }
- if (wp->w_p_list)
- c = lcs_eol;
- else
- c = ' ';
- lcs_eol_one = -1;
- --ptr; /* put it back at the NUL */
- if (!attr_pri)
- {
- extra_attr = hl_attr(HLF_AT);
- n_attr = 1;
- }
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- }
- else if (c != NUL)
- {
- p_extra = transchar(c);
-#ifdef FEAT_RIGHTLEFT
- if ((dy_flags & DY_UHEX) && wp->w_p_rl)
- rl_mirror(p_extra); /* reverse "<12>" */
-#endif
- n_extra = byte2cells(c) - 1;
- c_extra = NUL;
- c = *p_extra++;
- if (!attr_pri)
- {
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
-#ifdef FEAT_MBYTE
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- }
-#ifdef FEAT_VIRTUALEDIT
- else if (VIsual_active
- && (VIsual_mode == Ctrl_V
- || VIsual_mode == 'v')
- && virtual_active()
- && tocol != MAXCOL
- && vcol < tocol
- && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col < W_WIDTH(wp))))
- {
- c = ' ';
- --ptr; /* put it back at the NUL */
- }
-#endif
-#if defined(LINE_ATTR)
- else if ((
-# ifdef FEAT_DIFF
- diff_hlf != (hlf_T)0 ||
-# endif
- line_attr != 0
- ) && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col
-# ifdef FEAT_CONCEAL
- - boguscols
-# endif
- < W_WIDTH(wp))))
- {
- /* Highlight until the right side of the window */
- c = ' ';
- --ptr; /* put it back at the NUL */
-
- /* Remember we do the char for line highlighting. */
- ++did_line_attr;
-
- /* don't do search HL for the rest of the line */
- if (line_attr != 0 && char_attr == search_attr && col > 0)
- char_attr = line_attr;
-# ifdef FEAT_DIFF
- if (diff_hlf == HLF_TXD)
- {
- diff_hlf = HLF_CHD;
- if (attr == 0 || char_attr != attr)
- char_attr = hl_attr(diff_hlf);
- }
-# endif
- }
-#endif
}
#ifdef FEAT_CONCEAL
@@ -4564,9 +4553,13 @@
/* Don't override visual selection highlighting. */
if (n_attr > 0
- && draw_state == WL_LINE
- && !attr_pri)
- char_attr = extra_attr;
+ && draw_state == WL_LINE)
+ {
+ if (!attr_pri)
+ char_attr = extra_attr;
+ else
+ char_attr = hl_combine_attr(char_attr, extra_attr);
+ }
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
/* XIM don't send preedit_start and preedit_end, but they send
@@ -4640,12 +4633,9 @@
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
#endif
- if (!attr_pri)
- {
- saved_attr3 = char_attr; /* save current attr */
- char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
- n_attr3 = 1;
- }
+ saved_attr3 = char_attr; /* save current attr */
+ char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
+ n_attr3 = 1;
}
/*
diff -r c61da758a9a2 src/screen.c
--- a/src/screen.c Wed Apr 24 18:34:45 2013 +0200
+++ b/src/screen.c Sun Apr 28 19:59:19 2013 +0900
@@ -3941,12 +3941,9 @@
mb_utf8 = (c >= 0x80);
n_extra = (int)STRLEN(p_extra);
c_extra = NUL;
- if (area_attr == 0 && search_attr == 0)
- {
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
}
else if (mb_l == 0) /* at the NUL at end-of-line */
mb_l = 1;
@@ -4073,26 +4070,258 @@
) && lcs_nbsp)
{
c = lcs_nbsp;
- if (area_attr == 0 && search_attr == 0)
- {
+ n_attr = 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE;
+#endif
+ }
+
+ if (extra_check)
+ {
+#ifdef FEAT_LINEBREAK
+ /*
+ * Found last space before word: check for line break.
+ */
+ if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
+ && !wp->w_p_list)
+ {
+ n_extra = win_lbr_chartabsize(wp, ptr - (
+# ifdef FEAT_MBYTE
+ has_mbyte ? mb_l :
+# endif
+ 1), (colnr_T)vcol, NULL) - 1;
+ c_extra = ' ';
+ if (vim_iswhite(c))
+ c = ' ';
+ }
+#endif
+
+ if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
+ {
+ c = lcs_trail;
n_attr = 1;
extra_attr = hl_attr(HLF_8);
saved_attr2 = char_attr; /* save current attr */
- }
#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE;
-#endif
- }
-
- if (extra_check)
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE;
+#endif
+ }
+ }
+
+ /*
+ * Handling of non-printable characters.
+ */
+ if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
+ {
+ /*
+ * when getting a character from the file, we may have to
+ * turn it into something else on the way to putting it
+ * into "ScreenLines".
+ */
+ if (c == TAB && (!wp->w_p_list || lcs_tab1))
+ {
+ /* tab amount depends on current column */
+ n_extra = (int)wp->w_buffer->b_p_ts
+ - vcol % (int)wp->w_buffer->b_p_ts - 1;
+#ifdef FEAT_CONCEAL
+ /* Tab alignment should be identical regardless of
+ * 'conceallevel' value. So tab compensates of all
+ * previous concealed characters, and thus resets vcol_off
+ * and boguscols accumulated so far in the line. Note that
+ * the tab can be longer than 'tabstop' when there
+ * are concealed characters. */
+ n_extra += vcol_off;
+ vcol -= vcol_off;
+ vcol_off = 0;
+ col -= boguscols;
+ boguscols = 0;
+#endif
+#ifdef FEAT_MBYTE
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ if (wp->w_p_list)
+ {
+ c = lcs_tab1;
+ c_extra = lcs_tab2;
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+#endif
+ }
+ else
+ {
+ c_extra = ' ';
+ c = ' ';
+ }
+ }
+ else if (c == NUL
+ && ((wp->w_p_list && lcs_eol > 0)
+ || ((fromcol >= 0 || fromcol_prev >= 0)
+ && tocol > vcol
+#ifdef FEAT_VISUAL
+ && VIsual_mode != Ctrl_V
+#endif
+ && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col < W_WIDTH(wp)))
+ && !(noinvcur
+ && lnum == wp->w_cursor.lnum
+ && (colnr_T)vcol == wp->w_virtcol)))
+ && lcs_eol_one >= 0)
+ {
+ /* Display a '$' after the line or highlight an extra
+ * character if the line break is included. */
+#if defined(FEAT_DIFF) || defined(LINE_ATTR)
+ /* For a diff line the highlighting continues after the
+ * "$". */
+ if (
+# ifdef FEAT_DIFF
+ diff_hlf == (hlf_T)0
+# ifdef LINE_ATTR
+ &&
+# endif
+# endif
+# ifdef LINE_ATTR
+ line_attr == 0
+# endif
+ )
+#endif
+ {
+#ifdef FEAT_VIRTUALEDIT
+ /* In virtualedit, visual selections may extend
+ * beyond end of line. */
+ if (area_highlighting && virtual_active()
+ && tocol != MAXCOL && vcol < tocol)
+ n_extra = 0;
+ else
+#endif
+ {
+ p_extra = at_end_str;
+ n_extra = 1;
+ c_extra = NUL;
+ }
+ }
+ if (wp->w_p_list)
+ c = lcs_eol;
+ else
+ c = ' ';
+ lcs_eol_one = -1;
+ --ptr; /* put it back at the NUL */
+ extra_attr = hl_attr(HLF_AT);
+ n_attr = 1;
+#ifdef FEAT_MBYTE
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1)
+ {
+ mb_utf8 = TRUE;
+ u8cc[0] = 0;
+ c = 0xc0;
+ }
+ else
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ }
+ else if (c != NUL)
+ {
+ p_extra = transchar(c);
+#ifdef FEAT_RIGHTLEFT
+ if ((dy_flags & DY_UHEX) && wp->w_p_rl)
+ rl_mirror(p_extra); /* reverse "<12>" */
+#endif
+ n_extra = byte2cells(c) - 1;
+ c_extra = NUL;
+ c = *p_extra++;
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; /* save current attr */
+#ifdef FEAT_MBYTE
+ mb_utf8 = FALSE; /* don't draw as UTF-8 */
+#endif
+ }
+#ifdef FEAT_VIRTUALEDIT
+ else if (VIsual_active
+ && (VIsual_mode == Ctrl_V
+ || VIsual_mode == 'v')
+ && virtual_active()
+ && tocol != MAXCOL
+ && vcol < tocol
+ && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col < W_WIDTH(wp))))
+ {
+ c = ' ';
+ --ptr; /* put it back at the NUL */
+ }
+#endif
+#if defined(LINE_ATTR)
+ else if ((
+# ifdef FEAT_DIFF
+ diff_hlf != (hlf_T)0 ||
+# endif
+ line_attr != 0
+ ) && (
+# ifdef FEAT_RIGHTLEFT
+ wp->w_p_rl ? (col >= 0) :
+# endif
+ (col
+# ifdef FEAT_CONCEAL
+ - boguscols
+# endif
+ < W_WIDTH(wp))))
+ {
+ /* Highlight until the right side of the window */
+ c = ' ';
+ --ptr; /* put it back at the NUL */
+
+ /* Remember we do the char for line highlighting. */
+ ++did_line_attr;
+
+ /* don't do search HL for the rest of the line */
+ if (line_attr != 0 && char_attr == search_attr && col > 0)
+ char_attr = line_attr;
+# ifdef FEAT_DIFF
+ if (diff_hlf == HLF_TXD)
+ {
+ diff_hlf = HLF_CHD;
+ if (attr == 0 || char_attr != attr)
+ char_attr = hl_attr(diff_hlf);
+ }
+# endif
+ }
+#endif
+ }
+
+ if (extra_check && n_attr == 0)
{
#ifdef FEAT_SPELL
int can_spell = TRUE;
@@ -4236,246 +4465,6 @@
char_attr = hl_combine_attr(spell_attr, char_attr);
}
#endif
-#ifdef FEAT_LINEBREAK
- /*
- * Found last space before word: check for line break.
- */
- if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
- && !wp->w_p_list)
- {
- n_extra = win_lbr_chartabsize(wp, ptr - (
-# ifdef FEAT_MBYTE
- has_mbyte ? mb_l :
-# endif
- 1), (colnr_T)vcol, NULL) - 1;
- c_extra = ' ';
- if (vim_iswhite(c))
- c = ' ';
- }
-#endif
-
- if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
- {
- c = lcs_trail;
- if (!attr_pri)
- {
- n_attr = 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE;
-#endif
- }
- }
-
- /*
- * Handling of non-printable characters.
- */
- if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
- {
- /*
- * when getting a character from the file, we may have to
- * turn it into something else on the way to putting it
- * into "ScreenLines".
- */
- if (c == TAB && (!wp->w_p_list || lcs_tab1))
- {
- /* tab amount depends on current column */
- n_extra = (int)wp->w_buffer->b_p_ts
- - vcol % (int)wp->w_buffer->b_p_ts - 1;
-#ifdef FEAT_CONCEAL
- /* Tab alignment should be identical regardless of
- * 'conceallevel' value. So tab compensates of all
- * previous concealed characters, and thus resets vcol_off
- * and boguscols accumulated so far in the line. Note that
- * the tab can be longer than 'tabstop' when there
- * are concealed characters. */
- n_extra += vcol_off;
- vcol -= vcol_off;
- vcol_off = 0;
- col -= boguscols;
- boguscols = 0;
-#endif
-#ifdef FEAT_MBYTE
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- if (wp->w_p_list)
- {
- c = lcs_tab1;
- c_extra = lcs_tab2;
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
-#endif
- }
- else
- {
- c_extra = ' ';
- c = ' ';
- }
- }
- else if (c == NUL
- && ((wp->w_p_list && lcs_eol > 0)
- || ((fromcol >= 0 || fromcol_prev >= 0)
- && tocol > vcol
-#ifdef FEAT_VISUAL
- && VIsual_mode != Ctrl_V
-#endif
- && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col < W_WIDTH(wp)))
- && !(noinvcur
- && lnum == wp->w_cursor.lnum
- && (colnr_T)vcol == wp->w_virtcol)))
- && lcs_eol_one >= 0)
- {
- /* Display a '$' after the line or highlight an extra
- * character if the line break is included. */
-#if defined(FEAT_DIFF) || defined(LINE_ATTR)
- /* For a diff line the highlighting continues after the
- * "$". */
- if (
-# ifdef FEAT_DIFF
- diff_hlf == (hlf_T)0
-# ifdef LINE_ATTR
- &&
-# endif
-# endif
-# ifdef LINE_ATTR
- line_attr == 0
-# endif
- )
-#endif
- {
-#ifdef FEAT_VIRTUALEDIT
- /* In virtualedit, visual selections may extend
- * beyond end of line. */
- if (area_highlighting && virtual_active()
- && tocol != MAXCOL && vcol < tocol)
- n_extra = 0;
- else
-#endif
- {
- p_extra = at_end_str;
- n_extra = 1;
- c_extra = NUL;
- }
- }
- if (wp->w_p_list)
- c = lcs_eol;
- else
- c = ' ';
- lcs_eol_one = -1;
- --ptr; /* put it back at the NUL */
- if (!attr_pri)
- {
- extra_attr = hl_attr(HLF_AT);
- n_attr = 1;
- }
-#ifdef FEAT_MBYTE
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
- {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- }
- else
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- }
- else if (c != NUL)
- {
- p_extra = transchar(c);
-#ifdef FEAT_RIGHTLEFT
- if ((dy_flags & DY_UHEX) && wp->w_p_rl)
- rl_mirror(p_extra); /* reverse "<12>" */
-#endif
- n_extra = byte2cells(c) - 1;
- c_extra = NUL;
- c = *p_extra++;
- if (!attr_pri)
- {
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
-#ifdef FEAT_MBYTE
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
-#endif
- }
-#ifdef FEAT_VIRTUALEDIT
- else if (VIsual_active
- && (VIsual_mode == Ctrl_V
- || VIsual_mode == 'v')
- && virtual_active()
- && tocol != MAXCOL
- && vcol < tocol
- && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col < W_WIDTH(wp))))
- {
- c = ' ';
- --ptr; /* put it back at the NUL */
- }
-#endif
-#if defined(LINE_ATTR)
- else if ((
-# ifdef FEAT_DIFF
- diff_hlf != (hlf_T)0 ||
-# endif
- line_attr != 0
- ) && (
-# ifdef FEAT_RIGHTLEFT
- wp->w_p_rl ? (col >= 0) :
-# endif
- (col
-# ifdef FEAT_CONCEAL
- - boguscols
-# endif
- < W_WIDTH(wp))))
- {
- /* Highlight until the right side of the window */
- c = ' ';
- --ptr; /* put it back at the NUL */
-
- /* Remember we do the char for line highlighting. */
- ++did_line_attr;
-
- /* don't do search HL for the rest of the line */
- if (line_attr != 0 && char_attr == search_attr && col > 0)
- char_attr = line_attr;
-# ifdef FEAT_DIFF
- if (diff_hlf == HLF_TXD)
- {
- diff_hlf = HLF_CHD;
- if (attr == 0 || char_attr != attr)
- char_attr = hl_attr(diff_hlf);
- }
-# endif
- }
-#endif
}
#ifdef FEAT_CONCEAL
@@ -4564,9 +4553,13 @@
/* Don't override visual selection highlighting. */
if (n_attr > 0
- && draw_state == WL_LINE
- && !attr_pri)
- char_attr = extra_attr;
+ && draw_state == WL_LINE)
+ {
+ if (!attr_pri)
+ char_attr = extra_attr;
+ else
+ char_attr = hl_combine_attr(extra_attr, char_attr);
+ }
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
/* XIM don't send preedit_start and preedit_end, but they send
@@ -4640,12 +4633,9 @@
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
#endif
- if (!attr_pri)
- {
- saved_attr3 = char_attr; /* save current attr */
- char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
- n_attr3 = 1;
- }
+ saved_attr3 = char_attr; /* save current attr */
+ char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
+ n_attr3 = 1;
}
/*
<<attachment: comparison.png>>
