Mercurial > vim
comparison src/screen.c @ 16211:5fb0f15fafea v8.1.1110
patch 8.1.1110: composing chars on space wrong when 'listchars' is set
commit https://github.com/vim/vim/commit/e5e4e22c1c15c8c22b14935affe969569acc8df9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 4 13:28:45 2019 +0200
patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Problem: Composing chars on space wrong when 'listchars' is set.
Solution: Do not use "space" and "nbsp" entries of 'listchars' when there is
a composing character. (Yee Cheng Chin, closes #4197)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Apr 2019 13:30:05 +0200 |
parents | cd5c83115ec6 |
children | 57e0f6b4a87d |
comparison
equal
deleted
inserted
replaced
16210:4ef3771aa5e2 | 16211:5fb0f15fafea |
---|---|
4806 c = ' '; | 4806 c = ' '; |
4807 } | 4807 } |
4808 } | 4808 } |
4809 #endif | 4809 #endif |
4810 | 4810 |
4811 // 'list': change char 160 to lcs_nbsp and space to lcs_space. | 4811 // 'list': Change char 160 to lcs_nbsp and space to lcs_space. |
4812 if (wp->w_p_list) | 4812 // But not when the character is followed by a composing |
4813 { | 4813 // character (use mb_l to check that). |
4814 if ((c == 160 | 4814 if (wp->w_p_list |
4815 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f))) | 4815 && ((((c == 160 && mb_l == 1) |
4816 && lcs_nbsp) | 4816 || (mb_utf8 |
4817 && ((mb_c == 160 && mb_l == 2) | |
4818 || (mb_c == 0x202f && mb_l == 3)))) | |
4819 && lcs_nbsp) | |
4820 || (c == ' ' | |
4821 && mb_l == 1 | |
4822 && lcs_space | |
4823 && ptr - line <= trailcol))) | |
4824 { | |
4825 c = (c == ' ') ? lcs_space : lcs_nbsp; | |
4826 if (area_attr == 0 && search_attr == 0) | |
4817 { | 4827 { |
4818 c = lcs_nbsp; | 4828 n_attr = 1; |
4819 mb_c = c; | 4829 extra_attr = HL_ATTR(HLF_8); |
4820 if (enc_utf8 && utf_char2len(c) > 1) | 4830 saved_attr2 = char_attr; /* save current attr */ |
4821 { | |
4822 mb_utf8 = TRUE; | |
4823 u8cc[0] = 0; | |
4824 c = 0xc0; | |
4825 } | |
4826 else | |
4827 mb_utf8 = FALSE; | |
4828 } | 4831 } |
4829 else if (c == ' ' && lcs_space && ptr - line <= trailcol) | 4832 mb_c = c; |
4833 if (enc_utf8 && utf_char2len(c) > 1) | |
4830 { | 4834 { |
4831 c = lcs_space; | 4835 mb_utf8 = TRUE; |
4832 if (mb_utf8 == FALSE && area_attr == 0 && search_attr == 0) | 4836 u8cc[0] = 0; |
4833 { | 4837 c = 0xc0; |
4834 n_attr = 1; | |
4835 extra_attr = HL_ATTR(HLF_8); | |
4836 saved_attr2 = char_attr; // save current attr | |
4837 } | |
4838 } | 4838 } |
4839 else | |
4840 mb_utf8 = FALSE; | |
4839 } | 4841 } |
4840 | 4842 |
4841 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') | 4843 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') |
4842 { | 4844 { |
4843 c = lcs_trail; | 4845 c = lcs_trail; |