2013年5月3日金曜日 5時37分36秒 UTC+9 [email protected]:
> 2013年5月2日木曜日 22時37分48秒 UTC+9 Ingo Karkat:
>
> > On 30-Apr-2013 06:38 +0200, nayuri.aohime wrote:
>
> >
>
> >
>
> >
>
> > > 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.
>
> >
>
> >
>
> >
>
> > +1 from me; I also think the CursorLine_overrides_SpecialKey.patch is
>
> >
>
> > better. Thank you for including the graphical comparison; that's really
>
> >
>
> > helpful!
>
> >
>
> >
>
> >
>
> > Though purely cosmetic, this issue is indeed disturbing people; e.g. see
>
> >
>
> > the following Stack Overflow questions about this:
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > http://stackoverflow.com/questions/8248872/in-vim-can-you-stop-the-color-change-of-white-space-characters-with-set-cursorl
>
> >
>
> >
>
> >
>
> > http://stackoverflow.com/questions/15606098/set-visibility-and-or-color-of-listchars-or-conceal-cchar-in-vim-when-cursorline
>
> >
>
> >
>
> >
>
> > -- regards, ingo
>
> Hi,
>
>
>
> I've found a bug in the previous patch, but fixed.
>
> Contents of the bug are:
>
> * set list listchars=eol:$ conceallevel=1 concealcursor=nvic
>
> * syntax match NonText / / conceal cchar=.
>
> * Insert space(0x20), not displayed eol character.
>
>
>
> SpecialKey_overrides_CursorLine_ver2.patch
>
> -> Every highlighting listchars chatscters & conceal characters.
>
>
>
> CursorLine_overrides_SpecialKey_ver2.patch
>
> -> Easy to use because it is similar to the current version.
>
>
>
> This patches is ConcealCharacters will be treated the same as SpecialKey.
>
> Make the other versions it is easy.
>
>
>
> Best regards,
>
> DeaR
Hi,
Sorry, ver2 patches have a bug, but fixed it.
Contents of the bug are:
* :set number foldenable cuesorline
* Not highlighting line number columns & fold columns.
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 Fri May 03 16:46:51 2013 +0900
@@ -2844,7 +2844,7 @@
int syntax_flags = 0;
int syntax_seqnr = 0;
int prev_syntax_id = 0;
- int conceal_attr = hl_attr(HLF_CONCEAL);
+ int conceal_attr = 0;
int is_concealing = FALSE;
int boguscols = 0; /* nonexistent columns added to force
wrapping */
@@ -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,12 +4070,9 @@
) && 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 */
- }
+ 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)
@@ -4123,15 +4117,6 @@
else
did_emsg = save_did_emsg;
- /* Need to get the line again, a multi-line regexp may
- * have made it invalid. */
- line = ml_get_buf(wp->w_buffer, lnum, FALSE);
- ptr = line + v;
-
- if (!attr_pri)
- char_attr = syntax_attr;
- else
- char_attr = hl_combine_attr(syntax_attr, char_attr);
# ifdef FEAT_CONCEAL
/* no concealing past the end of the line, it interferes
* with line highlighting */
@@ -4257,12 +4242,9 @@
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 */
- }
+ 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)
@@ -4386,11 +4368,8 @@
c = ' ';
lcs_eol_one = -1;
--ptr; /* put it back at the NUL */
- if (!attr_pri)
- {
- extra_attr = hl_attr(HLF_AT);
- n_attr = 1;
- }
+ extra_attr = hl_attr(HLF_AT);
+ n_attr = 1;
#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1)
@@ -4413,12 +4392,9 @@
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 */
- }
+ 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
@@ -4486,7 +4462,7 @@
&& !(lnum_in_visual_area
&& vim_strchr(wp->w_p_cocu, 'v') == NULL))
{
- char_attr = conceal_attr;
+ conceal_attr = hl_attr(HLF_CONCEAL);
if (prev_syntax_id != syntax_seqnr
&& (syn_get_sub_char() != NUL || wp->w_p_cole == 1)
&& wp->w_p_cole != 3)
@@ -4544,6 +4520,7 @@
{
prev_syntax_id = 0;
is_concealing = FALSE;
+ conceal_attr = 0;
}
#endif /* FEAT_CONCEAL */
}
@@ -4564,9 +4541,42 @@
/* 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);
+ }
+#ifdef FEAT_CONCEAL
+ else if (conceal_attr > 0)
+ {
+ if (!attr_pri)
+ char_attr = conceal_attr;
+ else
+ char_attr = hl_combine_attr(conceal_attr, char_attr);
+ }
+#endif
+ else if (extra_check)
+ {
+#ifdef FEAT_SYN_HL
+ /* Get syntax attribute, unless still at the start of the line
+ * (double-wide char that doesn't fit). */
+ v = (long)(ptr - line);
+ if (has_syntax && v > 0)
+ {
+ /* Need to get the line again, a multi-line regexp may
+ * have made it invalid. */
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE);
+ ptr = line + v;
+
+ if (!attr_pri)
+ char_attr = syntax_attr;
+ else
+ char_attr = hl_combine_attr(syntax_attr, char_attr);
+ }
+#endif
+ }
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
/* XIM don't send preedit_start and preedit_end, but they send
diff -r c61da758a9a2 src/screen.c
--- a/src/screen.c Wed Apr 24 18:34:45 2013 +0200
+++ b/src/screen.c Fri May 03 16:47:04 2013 +0900
@@ -2844,7 +2844,7 @@
int syntax_flags = 0;
int syntax_seqnr = 0;
int prev_syntax_id = 0;
- int conceal_attr = hl_attr(HLF_CONCEAL);
+ int conceal_attr = 0;
int is_concealing = FALSE;
int boguscols = 0; /* nonexistent columns added to force
wrapping */
@@ -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,12 +4070,9 @@
) && 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 */
- }
+ 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)
@@ -4123,15 +4117,6 @@
else
did_emsg = save_did_emsg;
- /* Need to get the line again, a multi-line regexp may
- * have made it invalid. */
- line = ml_get_buf(wp->w_buffer, lnum, FALSE);
- ptr = line + v;
-
- if (!attr_pri)
- char_attr = syntax_attr;
- else
- char_attr = hl_combine_attr(syntax_attr, char_attr);
# ifdef FEAT_CONCEAL
/* no concealing past the end of the line, it interferes
* with line highlighting */
@@ -4257,12 +4242,9 @@
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 */
- }
+ 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)
@@ -4386,11 +4368,8 @@
c = ' ';
lcs_eol_one = -1;
--ptr; /* put it back at the NUL */
- if (!attr_pri)
- {
- extra_attr = hl_attr(HLF_AT);
- n_attr = 1;
- }
+ extra_attr = hl_attr(HLF_AT);
+ n_attr = 1;
#ifdef FEAT_MBYTE
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1)
@@ -4413,12 +4392,9 @@
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 */
- }
+ 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
@@ -4486,7 +4462,7 @@
&& !(lnum_in_visual_area
&& vim_strchr(wp->w_p_cocu, 'v') == NULL))
{
- char_attr = conceal_attr;
+ conceal_attr = hl_attr(HLF_CONCEAL);
if (prev_syntax_id != syntax_seqnr
&& (syn_get_sub_char() != NUL || wp->w_p_cole == 1)
&& wp->w_p_cole != 3)
@@ -4544,6 +4520,7 @@
{
prev_syntax_id = 0;
is_concealing = FALSE;
+ conceal_attr = 0;
}
#endif /* FEAT_CONCEAL */
}
@@ -4564,9 +4541,39 @@
/* 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);
+ }
+#ifdef FEAT_CONCEAL
+ else if (conceal_attr > 0)
+ {
+ char_attr = conceal_attr;
+ }
+#endif
+ else if (extra_check)
+ {
+#ifdef FEAT_SYN_HL
+ /* Get syntax attribute, unless still at the start of the line
+ * (double-wide char that doesn't fit). */
+ v = (long)(ptr - line);
+ if (has_syntax && v > 0)
+ {
+ /* Need to get the line again, a multi-line regexp may
+ * have made it invalid. */
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE);
+ ptr = line + v;
+
+ if (!attr_pri)
+ char_attr = syntax_attr;
+ else
+ char_attr = hl_combine_attr(syntax_attr, char_attr);
+ }
+#endif
+ }
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
/* XIM don't send preedit_start and preedit_end, but they send