mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
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)
5f8069bbf5
This commit is contained in:
parent
963474321b
commit
32663b0f7e
@ -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'.
|
// 'list': change char 160 to 'nbsp' and space to 'space'.
|
||||||
if (wp->w_p_list
|
if (wp->w_p_list) {
|
||||||
&& (((c == 160
|
if ((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
|
||||||
|| (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
|
&& wp->w_p_lcs_chars.nbsp) {
|
||||||
&& curwin->w_p_lcs_chars.nbsp)
|
c = wp->w_p_lcs_chars.nbsp;
|
||||||
|| (c == ' ' && curwin->w_p_lcs_chars.space
|
mb_c = c;
|
||||||
&& ptr - line >= leadcol
|
if (utf_char2len(c) > 1) {
|
||||||
&& ptr - line <= trailcol))) {
|
mb_utf8 = true;
|
||||||
c = (c == ' ') ? wp->w_p_lcs_chars.space : wp->w_p_lcs_chars.nbsp;
|
u8cc[0] = 0;
|
||||||
n_attr = 1;
|
c = 0xc0;
|
||||||
extra_attr = win_hl_attr(wp, HLF_0);
|
} else {
|
||||||
saved_attr2 = char_attr; // save current attr
|
mb_utf8 = false;
|
||||||
mb_c = c;
|
}
|
||||||
if (utf_char2len(c) > 1) {
|
} else if (c == ' '
|
||||||
mb_utf8 = true;
|
&& wp->w_p_lcs_chars.space
|
||||||
u8cc[0] = 0;
|
&& ptr - line >= leadcol
|
||||||
c = 0xc0;
|
&& ptr - line <= trailcol) {
|
||||||
} else {
|
c = wp->w_p_lcs_chars.space;
|
||||||
mb_utf8 = false;
|
if (mb_utf8 == false) {
|
||||||
|
n_attr = 1;
|
||||||
|
extra_attr = win_hl_attr(wp, HLF_0);
|
||||||
|
saved_attr2 = char_attr; // save current attr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,3 +181,26 @@ func Test_listchars()
|
|||||||
enew!
|
enew!
|
||||||
set listchars& ff&
|
set listchars& ff&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_listchars_composing()
|
||||||
|
enew!
|
||||||
|
let oldencoding=&encoding
|
||||||
|
set encoding=utf-8
|
||||||
|
set ff=unix
|
||||||
|
set list
|
||||||
|
|
||||||
|
set listchars=eol:$,space:_
|
||||||
|
call append(0, [
|
||||||
|
\ " \u3099 \u309A"
|
||||||
|
\ ])
|
||||||
|
let expected = [
|
||||||
|
\ "_ \u3099^I \u309A$"
|
||||||
|
\ ]
|
||||||
|
redraw!
|
||||||
|
call cursor(1, 1)
|
||||||
|
let got = ScreenLinesUtf8(1, virtcol('$'))
|
||||||
|
bw!
|
||||||
|
call assert_equal(expected, got)
|
||||||
|
let &encoding=oldencoding
|
||||||
|
set listchars& ff&
|
||||||
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user