mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
vim-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 vim/vim#8834)
f14b8ba137
This commit is contained in:
@@ -2081,6 +2081,8 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
||||
int change_end = -1; // last col of changed area
|
||||
colnr_T trailcol = MAXCOL; // start of trailing spaces
|
||||
colnr_T leadcol = 0; // start of leading spaces
|
||||
bool in_multispace = false; // in multiple consecutive spaces
|
||||
int multispace_pos = 0; // position in lcs-multispace string
|
||||
bool need_showbreak = false; // overlong line, skip first x chars
|
||||
sign_attrs_T sattrs[SIGN_SHOW_MAX]; // attributes for signs
|
||||
int num_signs; // number of signs for line
|
||||
@@ -2462,6 +2464,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
||||
|
||||
if (wp->w_p_list && !has_fold && !end_fill) {
|
||||
if (wp->w_p_lcs_chars.space
|
||||
|| wp->w_p_lcs_chars.multispace != NULL
|
||||
|| wp->w_p_lcs_chars.trail
|
||||
|| wp->w_p_lcs_chars.lead
|
||||
|| wp->w_p_lcs_chars.nbsp) {
|
||||
@@ -3580,6 +3583,11 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
||||
}
|
||||
}
|
||||
|
||||
in_multispace = c == ' ' && ((ptr > line + 1 && ptr[-2] == ' ') || *ptr == ' ');
|
||||
if (!in_multispace) {
|
||||
multispace_pos = 0;
|
||||
}
|
||||
|
||||
// 'list': Change char 160 to 'nbsp' and space to 'space'.
|
||||
// But not when the character is followed by a composing
|
||||
// character (use mb_l to check that).
|
||||
@@ -3591,10 +3599,18 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
||||
&& wp->w_p_lcs_chars.nbsp)
|
||||
|| (c == ' '
|
||||
&& mb_l == 1
|
||||
&& wp->w_p_lcs_chars.space
|
||||
&& (wp->w_p_lcs_chars.space
|
||||
|| (in_multispace && wp->w_p_lcs_chars.multispace != NULL))
|
||||
&& ptr - line >= leadcol
|
||||
&& ptr - line <= trailcol))) {
|
||||
c = (c == ' ') ? wp->w_p_lcs_chars.space : wp->w_p_lcs_chars.nbsp;
|
||||
if (in_multispace && wp->w_p_lcs_chars.multispace != NULL) {
|
||||
c = wp->w_p_lcs_chars.multispace[multispace_pos++];
|
||||
if (wp->w_p_lcs_chars.multispace[multispace_pos] == NUL) {
|
||||
multispace_pos = 0;
|
||||
}
|
||||
} else {
|
||||
c = (c == ' ') ? wp->w_p_lcs_chars.space : wp->w_p_lcs_chars.nbsp;
|
||||
}
|
||||
n_attr = 1;
|
||||
extra_attr = win_hl_attr(wp, HLF_0);
|
||||
saved_attr2 = char_attr; // save current attr
|
||||
|
Reference in New Issue
Block a user