hi all. I made this patch to support the third char of the tab. if given the optional third char to tab option, then the third char will appeared at end of tab. e.g. se lcs=tab:<->, then a four space tab will display as "<-->".
diff -r 916c90b37ea9 runtime/doc/options.txt --- a/runtime/doc/options.txt Fri Dec 10 20:35:50 2010 +0100 +++ b/runtime/doc/options.txt Fri Dec 17 13:32:29 2010 +0800 @@ -4534,11 +4534,14 @@ eol:c Character to show at the end of each line. When omitted, there is no extra character at the end of the line. - 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:xyz Two or three 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. the + third char is optional, if given, it will used once at + last of tab. "tab:>-" will show a tab that takes four spaces as - ">---". When omitted, a tab is show as ^I. + ">---". "tab:<->" will show a tab as "<-->". When + omitted, a tab is show as ^I. trail:c Character to show for trailing spaces. When omitted, trailing spaces are blank. extends:c Character to show in the last column, when 'wrap' is diff -r 916c90b37ea9 src/globals.h --- a/src/globals.h Fri Dec 10 20:35:50 2010 +0100 +++ b/src/globals.h Fri Dec 17 13:32:29 2010 +0800 @@ -1149,6 +1149,7 @@ EXTERN int lcs_nbsp INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); +EXTERN int lcs_tab3 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); #ifdef FEAT_CONCEAL EXTERN int lcs_conceal INIT(= '-'); diff -r 916c90b37ea9 src/message.c --- a/src/message.c Fri Dec 10 20:35:50 2010 +0100 +++ b/src/message.c Fri Dec 17 13:32:29 2010 +0800 @@ -1598,6 +1598,7 @@ int col = 0; int n_extra = 0; int c_extra = 0; + int c_end = 0; char_u *p_extra = NULL; /* init to make SASC shut up */ int n; int attr = 0; @@ -1628,8 +1629,13 @@ if (n_extra > 0) { --n_extra; - if (c_extra) + if (n_extra > 0 && c_extra) c = c_extra; + else if (n_extra == 0 && c_end) + { + c = c_end; + c_end = 0; + } else c = *p_extra++; } @@ -1656,11 +1662,13 @@ { c = ' '; c_extra = ' '; + c_end = ' '; } else { c = lcs_tab1; c_extra = lcs_tab2; + c_end = lcs_tab3; attr = hl_attr(HLF_8); } } diff -r 916c90b37ea9 src/option.c --- a/src/option.c Fri Dec 10 20:35:50 2010 +0100 +++ b/src/option.c Fri Dec 17 13:32:29 2010 +0800 @@ -7104,7 +7104,7 @@ { int round, i, len, entries; char_u *p, *s; - int c1, c2 = 0; + int c1, c2 = 0, c3 = 0; struct charstab { int *cp; @@ -7197,6 +7197,16 @@ #else c2 = *s++; #endif + if (!(*s == ',' || *s == NUL)) + { +#ifdef FEAT_MBYTE + c3 = mb_ptr2char_adv(&s); + if (mb_char2cells(c2) > 1) + continue; +#else + c3 = *s++; +#endif + } } if (*s == ',' || *s == NUL) { @@ -7206,6 +7216,7 @@ { lcs_tab1 = c1; lcs_tab2 = c2; + lcs_tab3 = c3; } else if (tab[i].cp != NULL) *(tab[i].cp) = c1; @@ -7322,7 +7333,7 @@ new_unnamed |= CLIP_UNNAMED; p += 7; } - else if (STRNCMP(p, "unnamedplus", 11) == 0 + else if (STRNCMP(p, "unnamedplus", 11) == 0 && (p[11] == ',' || p[11] == NUL)) { new_unnamed |= CLIP_UNNAMED_PLUS; diff -r 916c90b37ea9 src/screen.c --- a/src/screen.c Fri Dec 10 20:35:50 2010 +0100 +++ b/src/screen.c Fri Dec 17 13:32:29 2010 +0800 @@ -2682,6 +2682,7 @@ int n_extra = 0; /* number of extra chars */ char_u *p_extra = NULL; /* string of extra chars, plus NUL */ int c_extra = NUL; /* extra chars, all the same */ + int c_end = NUL; /* end char, for tab char */ 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 */ @@ -3750,9 +3751,12 @@ */ if (n_extra > 0) { - if (c_extra != NUL) - { - c = c_extra; + if (c_extra != NUL || (n_extra == 1 && c_end != NUL)) + { + if (n_extra == 1 && c_end != NUL) + c = c_end; + else + c = c_extra; #ifdef FEAT_MBYTE mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ if (enc_utf8 && (*mb_char2len)(c) > 1) @@ -4261,6 +4265,7 @@ { c = lcs_tab1; c_extra = lcs_tab2; + c_end = lcs_tab3; n_attr = n_extra + 1; extra_attr = hl_attr(HLF_8); saved_attr2 = char_attr; /* save current attr */ @@ -4277,6 +4282,7 @@ else { c_extra = ' '; + c_end = ' '; c = ' '; } } -- 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