aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2021-09-19 13:13:44 +0800
committerzeertzjq <zeertzjq@outlook.com>2021-09-19 13:13:44 +0800
commit32663b0f7e5911a8bced6b65dfc43622aadba198 (patch)
tree4b340152f79e11f2f0b915477890e32e1c6bad5f /src/nvim/screen.c
parent963474321bcc02a5698c40b4677cd36ab8d4cebc (diff)
downloadrneovim-32663b0f7e5911a8bced6b65dfc43622aadba198.tar.gz
rneovim-32663b0f7e5911a8bced6b65dfc43622aadba198.tar.bz2
rneovim-32663b0f7e5911a8bced6b65dfc43622aadba198.zip
vim-patch:8.1.1078: when 'listchars' is set a composing char on a space is wrong
Problem: When 'listchars' is set a composing char on a space is wrong. Solution: Separate handling a non-breaking space and a space. (Yasuhiro Matsumoto, closes vim/vim#4046) https://github.com/vim/vim/commit/5f8069bbf5d989936a2f4d7a76ae42434017e3a2
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e1846d4569..5ce8e0b348 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3581,24 +3581,28 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
}
// 'list': change char 160 to 'nbsp' and space to 'space'.
- if (wp->w_p_list
- && (((c == 160
- || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
- && curwin->w_p_lcs_chars.nbsp)
- || (c == ' ' && curwin->w_p_lcs_chars.space
- && ptr - line >= leadcol
- && ptr - line <= trailcol))) {
- 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
- mb_c = c;
- if (utf_char2len(c) > 1) {
- mb_utf8 = true;
- u8cc[0] = 0;
- c = 0xc0;
- } else {
- mb_utf8 = false;
+ if (wp->w_p_list) {
+ if ((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
+ && wp->w_p_lcs_chars.nbsp) {
+ c = wp->w_p_lcs_chars.nbsp;
+ mb_c = c;
+ if (utf_char2len(c) > 1) {
+ mb_utf8 = true;
+ u8cc[0] = 0;
+ c = 0xc0;
+ } else {
+ mb_utf8 = false;
+ }
+ } else if (c == ' '
+ && wp->w_p_lcs_chars.space
+ && ptr - line >= leadcol
+ && ptr - line <= trailcol) {
+ c = wp->w_p_lcs_chars.space;
+ if (mb_utf8 == false) {
+ n_attr = 1;
+ extra_attr = win_hl_attr(wp, HLF_0);
+ saved_attr2 = char_attr; // save current attr
+ }
}
}