diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2019-01-25 16:45:29 +0100 |
---|---|---|
committer | Marco Hinz <mh.codebro@gmail.com> | 2019-01-26 14:45:48 +0100 |
commit | 2ae97f3d4c572387aa639af5d8550235bf0a2979 (patch) | |
tree | 77613f3e9a6adb7a62c4f1da5ac045c337128618 /src/nvim/option.c | |
parent | 2418aa3a4ac8f560373b940dbe0443fc79ab65ad (diff) | |
download | rneovim-2ae97f3d4c572387aa639af5d8550235bf0a2979.tar.gz rneovim-2ae97f3d4c572387aa639af5d8550235bf0a2979.tar.bz2 rneovim-2ae97f3d4c572387aa639af5d8550235bf0a2979.zip |
vim-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 vim/vim#3810)
https://github.com/vim/vim/commit/83a52171ba00b2b9fd2d1d22a07e38fc9fc69c1e
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 77728a16e8..d8e5b78e80 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3405,7 +3405,7 @@ static char_u *set_chars_option(win_T *wp, char_u **varp) { int round, i, len, entries; char_u *p, *s; - int c1, c2 = 0; + int c1 = 0, c2 = 0, c3 = 0; struct chars_tab { int *cp; ///< char value @@ -3462,6 +3462,7 @@ static char_u *set_chars_option(win_T *wp, char_u **varp) } if (varp == &wp->w_p_lcs) { wp->w_p_lcs_chars.tab1 = NUL; + wp->w_p_lcs_chars.tab3 = NUL; } } p = *varp; @@ -3471,6 +3472,7 @@ static char_u *set_chars_option(win_T *wp, char_u **varp) if (STRNCMP(p, tab[i].name, len) == 0 && p[len] == ':' && p[len + 1] != NUL) { + c1 = c2 = c3 = 0; s = p + len + 1; // TODO(bfredl): use schar_T representation and utfc_ptr2len @@ -3488,12 +3490,20 @@ static char_u *set_chars_option(win_T *wp, char_u **varp) if (mb_char2cells(c2) > 1 || (c2len == 1 && c2 > 127)) { continue; } + if (!(*s == ',' || *s == NUL)) { + int c3len = utf_ptr2len(s); + c3 = mb_cptr2char_adv((const char_u **)&s); + if (mb_char2cells(c3) > 1 || (c3len == 1 && c3 > 127)) { + continue; + } + } } if (*s == ',' || *s == NUL) { if (round) { if (tab[i].cp == &wp->w_p_lcs_chars.tab2) { wp->w_p_lcs_chars.tab1 = c1; wp->w_p_lcs_chars.tab2 = c2; + wp->w_p_lcs_chars.tab3 = c3; } else if (tab[i].cp != NULL) { *(tab[i].cp) = c1; } |