diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-25 06:31:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 06:31:52 +0800 |
commit | 7d4967547b2793a29f9bd602ec6819458be1bd49 (patch) | |
tree | cd405ae99d784613e2222bdf14c24a9b794b9915 /src/nvim/message.c | |
parent | 9154fc76b740c4b61ad78a1cb7620c7e1b6d0494 (diff) | |
download | rneovim-7d4967547b2793a29f9bd602ec6819458be1bd49.tar.gz rneovim-7d4967547b2793a29f9bd602ec6819458be1bd49.tar.bz2 rneovim-7d4967547b2793a29f9bd602ec6819458be1bd49.zip |
vim-patch:9.0.1938: multispace wrong when scrolling horizontally (#25348)
Problem: multispace wrong when scrolling horizontally
Solution: Update position in "multispace" or "leadmultispace" also in
skipped chars. Reorder conditions to be more consistent.
closes: vim/vim#13145
closes: vim/vim#13147
https://github.com/vim/vim/commit/abc808112ee5df58a9f612f2bb5a65389c2c14e1
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 98e5a231b8..ad78092cac 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1907,10 +1907,13 @@ void msg_prt_line(const char *s, int list) continue; } else { attr = 0; - c = (unsigned char)(*s++); - in_multispace = c == ' ' && ((col > 0 && s[-2] == ' ') || *s == ' '); - if (!in_multispace) { - multispace_pos = 0; + c = (uint8_t)(*s++); + if (list) { + in_multispace = c == ' ' && (*s == ' ' + || (col > 0 && s[-2] == ' ')); + if (!in_multispace) { + multispace_pos = 0; + } } if (c == TAB && (!list || curwin->w_p_lcs_chars.tab1)) { // tab amount depends on current column @@ -1950,7 +1953,7 @@ void msg_prt_line(const char *s, int list) // the same in plain text. attr = HL_ATTR(HLF_0); } else if (c == ' ') { - if (list && lead != NULL && s <= lead && in_multispace + if (lead != NULL && s <= lead && in_multispace && curwin->w_p_lcs_chars.leadmultispace != NULL) { c = curwin->w_p_lcs_chars.leadmultispace[multispace_pos++]; if (curwin->w_p_lcs_chars.leadmultispace[multispace_pos] == NUL) { @@ -1963,7 +1966,7 @@ void msg_prt_line(const char *s, int list) } else if (trail != NULL && s > trail) { c = curwin->w_p_lcs_chars.trail; attr = HL_ATTR(HLF_0); - } else if (list && in_multispace + } else if (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) { |