Mercurial > vim
comparison src/message.c @ 25778:373278f5bd51 v8.2.3424
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Commit: https://github.com/vim/vim/commit/f14b8ba1373f569705cb80419248054100b02360
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri Sep 10 16:58:30 2021 +0200
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Problem: A sequence of spaces is hard to see in list mode.
Solution: Add the "multispace" option to 'listchars'. (closes https://github.com/vim/vim/issues/8834)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 10 Sep 2021 17:00:07 +0200 |
parents | f8bcd21e6e24 |
children | ae947ebb4038 |
comparison
equal
deleted
inserted
replaced
25777:584b2206c6d4 | 25778:373278f5bd51 |
---|---|
1839 char_u *p_extra = NULL; // init to make SASC shut up | 1839 char_u *p_extra = NULL; // init to make SASC shut up |
1840 int n; | 1840 int n; |
1841 int attr = 0; | 1841 int attr = 0; |
1842 char_u *trail = NULL; | 1842 char_u *trail = NULL; |
1843 char_u *lead = NULL; | 1843 char_u *lead = NULL; |
1844 int in_multispace = FALSE; | |
1845 int multispace_pos = 0; | |
1844 int l; | 1846 int l; |
1845 char_u buf[MB_MAXBYTES + 1]; | 1847 char_u buf[MB_MAXBYTES + 1]; |
1846 | 1848 |
1847 if (curwin->w_p_list) | 1849 if (curwin->w_p_list) |
1848 list = TRUE; | 1850 list = TRUE; |
1910 } | 1912 } |
1911 else | 1913 else |
1912 { | 1914 { |
1913 attr = 0; | 1915 attr = 0; |
1914 c = *s++; | 1916 c = *s++; |
1917 in_multispace = c == ' ' | |
1918 && ((col > 0 && s[-2] == ' ') || *s == ' '); | |
1919 if (!in_multispace) | |
1920 multispace_pos = 0; | |
1915 if (c == TAB && (!list || curwin->w_lcs_chars.tab1)) | 1921 if (c == TAB && (!list || curwin->w_lcs_chars.tab1)) |
1916 { | 1922 { |
1917 // tab amount depends on current column | 1923 // tab amount depends on current column |
1918 #ifdef FEAT_VARTABS | 1924 #ifdef FEAT_VARTABS |
1919 n_extra = tabstop_padding(col, curbuf->b_p_ts, | 1925 n_extra = tabstop_padding(col, curbuf->b_p_ts, |
1961 c = *p_extra++; | 1967 c = *p_extra++; |
1962 // Use special coloring to be able to distinguish <hex> from | 1968 // Use special coloring to be able to distinguish <hex> from |
1963 // the same in plain text. | 1969 // the same in plain text. |
1964 attr = HL_ATTR(HLF_8); | 1970 attr = HL_ATTR(HLF_8); |
1965 } | 1971 } |
1966 else if (c == ' ' && lead != NULL && s <= lead) | 1972 else if (c == ' ') |
1967 { | 1973 { |
1968 c = curwin->w_lcs_chars.lead; | 1974 if (lead != NULL && s <= lead) |
1969 attr = HL_ATTR(HLF_8); | 1975 { |
1970 } | 1976 c = curwin->w_lcs_chars.lead; |
1971 else if (c == ' ' && trail != NULL && s > trail) | 1977 attr = HL_ATTR(HLF_8); |
1972 { | 1978 } |
1973 c = curwin->w_lcs_chars.trail; | 1979 else if (trail != NULL && s > trail) |
1974 attr = HL_ATTR(HLF_8); | 1980 { |
1975 } | 1981 c = curwin->w_lcs_chars.trail; |
1976 else if (c == ' ' && list && curwin->w_lcs_chars.space != NUL) | 1982 attr = HL_ATTR(HLF_8); |
1977 { | 1983 } |
1978 c = curwin->w_lcs_chars.space; | 1984 else if (list && in_multispace |
1979 attr = HL_ATTR(HLF_8); | 1985 && curwin->w_lcs_chars.multispace != NULL) |
1986 { | |
1987 c = curwin->w_lcs_chars.multispace[multispace_pos++]; | |
1988 if (curwin->w_lcs_chars.multispace[multispace_pos] == NUL) | |
1989 multispace_pos = 0; | |
1990 attr = HL_ATTR(HLF_8); | |
1991 } | |
1992 else if (list && curwin->w_lcs_chars.space != NUL) | |
1993 { | |
1994 c = curwin->w_lcs_chars.space; | |
1995 attr = HL_ATTR(HLF_8); | |
1996 } | |
1980 } | 1997 } |
1981 } | 1998 } |
1982 | 1999 |
1983 if (c == NUL) | 2000 if (c == NUL) |
1984 break; | 2001 break; |