diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-09-19 14:31:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 14:31:10 -0400 |
commit | 89db07556dbdce97c0c150ed7e47d80e1ddacad3 (patch) | |
tree | a45ab65e275790c0ed853ad4906bcfa3bcd5154d /src/nvim/message.c | |
parent | 2aa662568a995ccfece490ca0f0f0cbdb9d57560 (diff) | |
parent | f4ce4c1677819472d1b094ef31b8db9c2549e55e (diff) | |
download | rneovim-89db07556dbdce97c0c150ed7e47d80e1ddacad3.tar.gz rneovim-89db07556dbdce97c0c150ed7e47d80e1ddacad3.tar.bz2 rneovim-89db07556dbdce97c0c150ed7e47d80e1ddacad3.zip |
Merge pull request #15630 from zeertzjq/vim-8.2.3424
vim-patch:8.1.{1071,1078,1079,1110},8.2.{2640,3424,3425,3437}
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index bd26b8608f..f9ed9f3004 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1707,6 +1707,8 @@ void msg_prt_line(char_u *s, int list) int n; int attr = 0; char_u *lead = NULL; + bool in_multispace = false; + int multispace_pos = 0; char_u *trail = NULL; int l; @@ -1771,6 +1773,10 @@ void msg_prt_line(char_u *s, int list) } else { attr = 0; c = *s++; + in_multispace = c == ' ' && ((col > 0 && s[-2] == ' ') || *s == ' '); + if (!in_multispace) { + multispace_pos = 0; + } if (c == TAB && (!list || curwin->w_p_lcs_chars.tab1)) { // tab amount depends on current column n_extra = tabstop_padding(col, @@ -1786,11 +1792,11 @@ void msg_prt_line(char_u *s, int list) : curwin->w_p_lcs_chars.tab1; c_extra = curwin->w_p_lcs_chars.tab2; c_final = curwin->w_p_lcs_chars.tab3; - attr = HL_ATTR(HLF_8); + attr = HL_ATTR(HLF_0); } } else if (c == 160 && list && curwin->w_p_lcs_chars.nbsp != NUL) { c = curwin->w_p_lcs_chars.nbsp; - attr = HL_ATTR(HLF_8); + attr = HL_ATTR(HLF_0); } else if (c == NUL && list && curwin->w_p_lcs_chars.eol != NUL) { p_extra = (char_u *)""; c_extra = NUL; @@ -1807,16 +1813,24 @@ void msg_prt_line(char_u *s, int list) c = *p_extra++; /* Use special coloring to be able to distinguish <hex> from * the same in plain text. */ - attr = HL_ATTR(HLF_8); - } else if (c == ' ' && lead != NULL && s <= lead) { - c = curwin->w_p_lcs_chars.lead; - attr = HL_ATTR(HLF_8); - } else if (c == ' ' && trail != NULL && s > trail) { - c = curwin->w_p_lcs_chars.trail; - attr = HL_ATTR(HLF_8); - } else if (c == ' ' && list && curwin->w_p_lcs_chars.space != NUL) { - c = curwin->w_p_lcs_chars.space; - attr = HL_ATTR(HLF_8); + attr = HL_ATTR(HLF_0); + } else if (c == ' ') { + if (lead != NULL && s <= lead) { + c = curwin->w_p_lcs_chars.lead; + attr = HL_ATTR(HLF_0); + } else if (trail != NULL && s > trail) { + c = curwin->w_p_lcs_chars.trail; + attr = HL_ATTR(HLF_0); + } else if (list && in_multispace && curwin->w_p_lcs_chars.multispace != NULL) { + c = curwin->w_p_lcs_chars.multispace[multispace_pos++]; + if (curwin->w_p_lcs_chars.multispace[multispace_pos] == NUL) { + multispace_pos = 0; + } + attr = HL_ATTR(HLF_0); + } else if (list && curwin->w_p_lcs_chars.space != NUL) { + c = curwin->w_p_lcs_chars.space; + attr = HL_ATTR(HLF_0); + } } } |