patch 8.1.0759: showing two characters for tab is limited
Problem: Showing two characters for tab is limited.
Solution: Allow for a third character for "tab:" in 'listchars'. (Nathaniel
Braun, Ken Takata, closes #3810)
diff --git a/src/option.c b/src/option.c
index ca3e3d8..ec058e9 100644
--- a/src/option.c
+++ b/src/option.c
@@ -7949,7 +7949,7 @@
{
int round, i, len, entries;
char_u *p, *s;
- int c1, c2 = 0;
+ int c1 = 0, c2 = 0, c3 = 0;
struct charstab
{
int *cp;
@@ -8001,8 +8001,12 @@
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 = '-';
}
@@ -8016,6 +8020,7 @@
&& p[len] == ':'
&& p[len + 1] != NUL)
{
+ c1 = c2 = c3 = 0;
s = p + len + 1;
#ifdef FEAT_MBYTE
c1 = mb_ptr2char_adv(&s);
@@ -8035,7 +8040,18 @@
#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)
@@ -8044,6 +8060,7 @@
{
lcs_tab1 = c1;
lcs_tab2 = c2;
+ lcs_tab3 = c3;
}
else if (tab[i].cp != NULL)
*(tab[i].cp) = c1;