Mercurial > vim
comparison src/option.c @ 15502:bc17a9d37810 v8.1.0759
patch 8.1.0759: showing two characters for tab is limited
commit https://github.com/vim/vim/commit/83a52171ba00b2b9fd2d1d22a07e38fc9fc69c1e
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 16 22:41:54 2019 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Jan 2019 22:45:07 +0100 |
parents | 126cdab63a83 |
children | dd725a8ab112 |
comparison
equal
deleted
inserted
replaced
15501:f1ba08812cf2 | 15502:bc17a9d37810 |
---|---|
7947 static char * | 7947 static char * |
7948 set_chars_option(char_u **varp) | 7948 set_chars_option(char_u **varp) |
7949 { | 7949 { |
7950 int round, i, len, entries; | 7950 int round, i, len, entries; |
7951 char_u *p, *s; | 7951 char_u *p, *s; |
7952 int c1, c2 = 0; | 7952 int c1 = 0, c2 = 0, c3 = 0; |
7953 struct charstab | 7953 struct charstab |
7954 { | 7954 { |
7955 int *cp; | 7955 int *cp; |
7956 char *name; | 7956 char *name; |
7957 }; | 7957 }; |
7999 /* After checking that the value is valid: set defaults: space for | 7999 /* After checking that the value is valid: set defaults: space for |
8000 * 'fillchars', NUL for 'listchars' */ | 8000 * 'fillchars', NUL for 'listchars' */ |
8001 for (i = 0; i < entries; ++i) | 8001 for (i = 0; i < entries; ++i) |
8002 if (tab[i].cp != NULL) | 8002 if (tab[i].cp != NULL) |
8003 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' '); | 8003 *(tab[i].cp) = (varp == &p_lcs ? NUL : ' '); |
8004 | |
8004 if (varp == &p_lcs) | 8005 if (varp == &p_lcs) |
8006 { | |
8005 lcs_tab1 = NUL; | 8007 lcs_tab1 = NUL; |
8008 lcs_tab3 = NUL; | |
8009 } | |
8006 else | 8010 else |
8007 fill_diff = '-'; | 8011 fill_diff = '-'; |
8008 } | 8012 } |
8009 p = *varp; | 8013 p = *varp; |
8010 while (*p) | 8014 while (*p) |
8014 len = (int)STRLEN(tab[i].name); | 8018 len = (int)STRLEN(tab[i].name); |
8015 if (STRNCMP(p, tab[i].name, len) == 0 | 8019 if (STRNCMP(p, tab[i].name, len) == 0 |
8016 && p[len] == ':' | 8020 && p[len] == ':' |
8017 && p[len + 1] != NUL) | 8021 && p[len + 1] != NUL) |
8018 { | 8022 { |
8023 c1 = c2 = c3 = 0; | |
8019 s = p + len + 1; | 8024 s = p + len + 1; |
8020 #ifdef FEAT_MBYTE | 8025 #ifdef FEAT_MBYTE |
8021 c1 = mb_ptr2char_adv(&s); | 8026 c1 = mb_ptr2char_adv(&s); |
8022 if (mb_char2cells(c1) > 1) | 8027 if (mb_char2cells(c1) > 1) |
8023 continue; | 8028 continue; |
8033 if (mb_char2cells(c2) > 1) | 8038 if (mb_char2cells(c2) > 1) |
8034 continue; | 8039 continue; |
8035 #else | 8040 #else |
8036 c2 = *s++; | 8041 c2 = *s++; |
8037 #endif | 8042 #endif |
8043 if (!(*s == ',' || *s == NUL)) | |
8044 { | |
8045 #ifdef FEAT_MBYTE | |
8046 c3 = mb_ptr2char_adv(&s); | |
8047 if (mb_char2cells(c3) > 1) | |
8048 continue; | |
8049 #else | |
8050 c3 = *s++; | |
8051 #endif | |
8052 } | |
8038 } | 8053 } |
8054 | |
8039 if (*s == ',' || *s == NUL) | 8055 if (*s == ',' || *s == NUL) |
8040 { | 8056 { |
8041 if (round) | 8057 if (round) |
8042 { | 8058 { |
8043 if (tab[i].cp == &lcs_tab2) | 8059 if (tab[i].cp == &lcs_tab2) |
8044 { | 8060 { |
8045 lcs_tab1 = c1; | 8061 lcs_tab1 = c1; |
8046 lcs_tab2 = c2; | 8062 lcs_tab2 = c2; |
8063 lcs_tab3 = c3; | |
8047 } | 8064 } |
8048 else if (tab[i].cp != NULL) | 8065 else if (tab[i].cp != NULL) |
8049 *(tab[i].cp) = c1; | 8066 *(tab[i].cp) = c1; |
8050 | 8067 |
8051 } | 8068 } |