aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-02-11 16:48:51 +0900
committerwatiko <service@mail.watiko.net>2016-02-11 17:08:36 +0900
commiteab6ed778dc41afe7cfc0b1d0201f6c47424d2c4 (patch)
treea071cb11330578e949be33b1bd6ce50c8693d53c /src/nvim/screen.c
parent8eb0d43c12dc5342b329aaabf1ab7c9cae691bc5 (diff)
downloadrneovim-eab6ed778dc41afe7cfc0b1d0201f6c47424d2c4.tar.gz
rneovim-eab6ed778dc41afe7cfc0b1d0201f6c47424d2c4.tar.bz2
rneovim-eab6ed778dc41afe7cfc0b1d0201f6c47424d2c4.zip
vim-patch:7.4.977
Problem: 'linebreak' does not work properly when using "space" in 'listchars'. Solution: (Hirohito Higashi, Christian Brabandt) https://github.com/vim/vim/commit/9bc01ebb957d2b30d57bd30d7aee6f1df2a336b0
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c63
1 files changed, 35 insertions, 28 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e036c49be4..ebad5039c5 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2430,13 +2430,18 @@ win_line (
}
}
- /* find start of trailing whitespace */
- if (wp->w_p_list && lcs_trail) {
- trailcol = (colnr_T)STRLEN(ptr);
- while (trailcol > (colnr_T)0 && ascii_iswhite(ptr[trailcol - 1]))
- --trailcol;
- trailcol += (colnr_T) (ptr - line);
- extra_check = TRUE;
+ if (wp->w_p_list) {
+ if (lcs_space || lcs_trail) {
+ extra_check = true;
+ }
+ // find start of trailing whitespace
+ if (lcs_trail) {
+ trailcol = (colnr_T)STRLEN(ptr);
+ while (trailcol > (colnr_T)0 && ascii_iswhite(ptr[trailcol - 1])) {
+ trailcol--;
+ }
+ trailcol += (colnr_T) (ptr - line);
+ }
}
/*
@@ -3201,27 +3206,7 @@ win_line (
}
}
- ++ptr;
-
- // 'list': change char 160 to lcs_nbsp and space to lcs_space.
- if (wp->w_p_list
- && (((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
- && lcs_nbsp)
- || (c == ' ' && lcs_space && ptr - line <= trailcol))) {
- c = (c == ' ') ? lcs_space : lcs_nbsp;
- if (area_attr == 0 && search_attr == 0) {
- n_attr = 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
- mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1) {
- mb_utf8 = TRUE;
- u8cc[0] = 0;
- c = 0xc0;
- } else
- mb_utf8 = FALSE;
- }
+ ptr++;
if (extra_check) {
bool can_spell = true;
@@ -3368,6 +3353,28 @@ win_line (
}
}
+ // 'list': change char 160 to lcs_nbsp and space to lcs_space.
+ if (wp->w_p_list
+ && (((c == 160
+ || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
+ && lcs_nbsp)
+ || (c == ' ' && lcs_space && ptr - line <= trailcol))) {
+ c = (c == ' ') ? lcs_space : lcs_nbsp;
+ if (area_attr == 0 && search_attr == 0) {
+ n_attr = 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; // save current attr
+ }
+ mb_c = c;
+ if (enc_utf8 && (*mb_char2len)(c) > 1) {
+ mb_utf8 = true;
+ u8cc[0] = 0;
+ c = 0xc0;
+ } else {
+ mb_utf8 = false;
+ }
+ }
+
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') {
c = lcs_trail;
if (!attr_pri) {