omitted, there is no extra character at the end of the
line.
*lcs-tab*
- tab:xy Two characters to be used to show a tab. The first
- char is used once. The second char is repeated to
- fill the space that the tab normally occupies.
- "tab:>-" will show a tab that takes four spaces as
- ">---". When omitted, a tab is show as ^I.
+ tab:xy[z] Two or three characters to be used to show a tab.
+ The third character is optional.
+
+ tab:xy The 'x' is always used, then 'y' as many times as will
+ fit. Thus "tab:>-" displays:
+ >
+ >-
+ >--
+ etc.
+
+ tab:xyz The 'z' is always used, then 'x' is prepended, and
+ then 'y' is used as many times as will fit. Thus
+ "tab:<->" displays:
+ >
+ <>
+ <->
+ <-->
+ etc.
+
+ When "tab:" is omitted, a tab is shown as ^I.
*lcs-space*
space:c Character to show for a space. When omitted, spaces
are left blank.
{
int round, i, len, entries;
char_u *p, *s;
- int c1, c2 = 0;
+ int c1 = 0, c2 = 0, c3 = 0;
struct charstab
{
int *cp;
for (i = 0; i < entries; ++i)
if (tab[i].cp != NULL)
*(tab[i].cp) = (varp == &p_lcs ? NUL : ' ');
+
if (varp == &p_lcs)
+ {
lcs_tab1 = NUL;
+ lcs_tab3 = NUL;
+ }
else
fill_diff = '-';
}
&& p[len] == ':'
&& p[len + 1] != NUL)
{
+ c1 = c2 = c3 = 0;
s = p + len + 1;
#ifdef FEAT_MBYTE
c1 = mb_ptr2char_adv(&s);
#else
c2 = *s++;
#endif
+ if (!(*s == ',' || *s == NUL))
+ {
+#ifdef FEAT_MBYTE
+ c3 = mb_ptr2char_adv(&s);
+ if (mb_char2cells(c3) > 1)
+ continue;
+#else
+ c3 = *s++;
+#endif
+ }
}
+
if (*s == ',' || *s == NUL)
{
if (round)
{
lcs_tab1 = c1;
lcs_tab2 = c2;
+ lcs_tab3 = c3;
}
else if (tab[i].cp != NULL)
*(tab[i].cp) = c1;
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
char_u *p_extra_free = NULL; /* p_extra needs to be freed */
int c_extra = NUL; /* extra chars, all the same */
+ int c_final = NUL; /* final char, mandatory if set */
int extra_attr = 0; /* attributes when n_extra != 0 */
static char_u *at_end_str = (char_u *)""; /* used for p_extra when
displaying lcs_eol at end-of-line */
int saved_n_extra = 0;
char_u *saved_p_extra = NULL;
int saved_c_extra = 0;
+ int saved_c_final = 0;
int saved_char_attr = 0;
int n_attr = 0; /* chars with special attr */
/* Draw the cmdline character. */
n_extra = 1;
c_extra = cmdwin_type;
+ c_final = NUL;
char_attr = HL_ATTR(HLF_AT);
}
}
p_extra_free[n_extra] = NUL;
p_extra = p_extra_free;
c_extra = NUL;
+ c_final = NUL;
char_attr = HL_ATTR(HLF_FC);
}
}
/* Draw two cells with the sign value or blank. */
c_extra = ' ';
+ c_final = NUL;
char_attr = HL_ATTR(HLF_SC);
n_extra = 2;
{
/* Use the image in this position. */
c_extra = SIGN_BYTE;
+ c_final = NUL;
# ifdef FEAT_NETBEANS_INTG
if (buf_signcount(wp->w_buffer, lnum) > 1)
+ {
c_extra = MULTISIGN_BYTE;
+ c_final = NUL;
+ }
# endif
char_attr = icon_sign;
}
if (p_extra != NULL)
{
c_extra = NUL;
+ c_final = NUL;
n_extra = (int)STRLEN(p_extra);
}
char_attr = sign_get_attr(text_sign, FALSE);
#endif
p_extra = extra;
c_extra = NUL;
+ c_final = NUL;
}
else
+ {
c_extra = ' ';
+ c_final = NUL;
+ }
n_extra = number_width(wp) + 1;
char_attr = HL_ATTR(HLF_N);
#ifdef FEAT_SYN_HL
{
/* Draw "deleted" diff line(s). */
if (char2cells(fill_diff) > 1)
+ {
c_extra = '-';
+ c_final = NUL;
+ }
else
+ {
c_extra = fill_diff;
+ c_final = NUL;
+ }
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
n_extra = col + 1;
/* Draw 'showbreak' at the start of each broken line. */
p_extra = p_sbr;
c_extra = NUL;
+ c_final = NUL;
n_extra = (int)STRLEN(p_sbr);
char_attr = HL_ATTR(HLF_AT);
need_showbreak = FALSE;
/* Continue item from end of wrapped line. */
n_extra = saved_n_extra;
c_extra = saved_c_extra;
+ c_final = saved_c_final;
p_extra = saved_p_extra;
char_attr = saved_char_attr;
}
* The "p_extra" points to the extra stuff that is inserted to
* represent special characters (non-printable stuff) and other
* things. When all characters are the same, c_extra is used.
+ * If c_final is set, it will compulsorily be used at the end.
* "p_extra" must end in a NUL to avoid mb_ptr2len() reads past
* "p_extra[n_extra]".
* For the '$' of the 'list' option, n_extra == 1, p_extra == "".
*/
if (n_extra > 0)
{
- if (c_extra != NUL)
+ if (c_extra != NUL || (n_extra == 1 && c_final != NUL))
{
- c = c_extra;
+ c = (n_extra == 1 && c_final != NUL) ? c_final : c_extra;
#ifdef FEAT_MBYTE
mb_c = c; /* doesn't handle non-utf-8 multi-byte! */
if (enc_utf8 && utf_char2len(c) > 1)
mb_utf8 = (c >= 0x80);
n_extra = (int)STRLEN(p_extra);
c_extra = NUL;
+ c_final = NUL;
if (area_attr == 0 && search_attr == 0)
{
n_attr = n_extra + 1;
p_extra = extra;
n_extra = (int)STRLEN(extra) - 1;
c_extra = NUL;
+ c_final = NUL;
c = *p_extra++;
if (area_attr == 0 && search_attr == 0)
{
{
n_extra = 1;
c_extra = MB_FILLER_CHAR;
+ c_final = NUL;
c = ' ';
if (area_attr == 0 && search_attr == 0)
{
# else
c_extra = ' ';
# endif
+ c_final = NUL;
if (VIM_ISWHITE(c))
{
#ifdef FEAT_CONCEAL
#endif
if (wp->w_p_list)
{
- c = lcs_tab1;
+ c = (n_extra == 0 && lcs_tab3) ? lcs_tab3 : lcs_tab1;
#ifdef FEAT_LINEBREAK
if (wp->w_p_lbr)
c_extra = NUL; /* using p_extra from above */
else
#endif
c_extra = lcs_tab2;
+ c_final = lcs_tab3;
n_attr = tab_len + 1;
extra_attr = HL_ATTR(HLF_8);
saved_attr2 = char_attr; /* save current attr */
}
else
{
+ c_final = NUL;
c_extra = ' ';
c = ' ';
}
p_extra = at_end_str;
n_extra = 1;
c_extra = NUL;
+ c_final = NUL;
}
}
if (wp->w_p_list && lcs_eol > 0)
rl_mirror(p_extra); /* reverse "<12>" */
#endif
c_extra = NUL;
+ c_final = NUL;
#ifdef FEAT_LINEBREAK
if (wp->w_p_lbr)
{
/* Double-width character being overwritten by the "precedes"
* character, need to fill up half the character. */
c_extra = MB_FILLER_CHAR;
+ c_final = NUL;
n_extra = 1;
n_attr = 2;
extra_attr = HL_ATTR(HLF_AT);
saved_n_extra = n_extra;
saved_p_extra = p_extra;
saved_c_extra = c_extra;
+ saved_c_final = c_final;
saved_char_attr = char_attr;
n_extra = 0;
lcs_prec_todo = lcs_prec;