Mercurial > vim
comparison src/screen.c @ 16146:aaa6e9a43a60 v8.1.1078
patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
commit https://github.com/vim/vim/commit/5f8069bbf5d989936a2f4d7a76ae42434017e3a2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 30 15:34:47 2019 +0100
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 #4046)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Mar 2019 15:45:05 +0100 |
parents | 5a2033905f19 |
children | f344647acbbc |
comparison
equal
deleted
inserted
replaced
16145:3ac2f32abf22 | 16146:aaa6e9a43a60 |
---|---|
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 */ | 4812 if (wp->w_p_list) |
4813 if (wp->w_p_list | 4813 { |
4814 && (((c == 160 | 4814 if ((c == 160 |
4815 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f))) | 4815 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f))) |
4816 && lcs_nbsp) | 4816 && lcs_nbsp) |
4817 || (c == ' ' && lcs_space && ptr - line <= trailcol))) | |
4818 { | |
4819 c = (c == ' ') ? lcs_space : lcs_nbsp; | |
4820 if (area_attr == 0 && search_attr == 0) | |
4821 { | 4817 { |
4822 n_attr = 1; | 4818 c = lcs_nbsp; |
4823 extra_attr = HL_ATTR(HLF_8); | 4819 mb_c = c; |
4824 saved_attr2 = char_attr; /* save current attr */ | 4820 if (enc_utf8 && utf_char2len(c) > 1) |
4821 { | |
4822 mb_utf8 = TRUE; | |
4823 u8cc[0] = 0; | |
4824 c = 0xc0; | |
4825 } | |
4826 else | |
4827 mb_utf8 = FALSE; | |
4825 } | 4828 } |
4826 mb_c = c; | 4829 else if (c == ' ' && lcs_space && ptr - line <= trailcol) |
4827 if (enc_utf8 && utf_char2len(c) > 1) | |
4828 { | 4830 { |
4829 mb_utf8 = TRUE; | 4831 c = lcs_space; |
4830 u8cc[0] = 0; | 4832 if (mb_utf8 == FALSE && area_attr == 0 && search_attr == 0) |
4831 c = 0xc0; | 4833 { |
4834 n_attr = 1; | |
4835 extra_attr = HL_ATTR(HLF_8); | |
4836 saved_attr2 = char_attr; // save current attr | |
4837 } | |
4832 } | 4838 } |
4833 else | |
4834 mb_utf8 = FALSE; | |
4835 } | 4839 } |
4836 | 4840 |
4837 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') | 4841 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') |
4838 { | 4842 { |
4839 c = lcs_trail; | 4843 c = lcs_trail; |