diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-07 20:01:46 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-06-09 21:26:23 +0800 |
commit | d6247a575c12f413e21ff5e7e94a86214246579d (patch) | |
tree | f523118e6d5f262eba282be387ad210978f6fa9a /src/nvim/screen.c | |
parent | 3da3cfc864e89a2dca6917183915683373c85af8 (diff) | |
download | rneovim-d6247a575c12f413e21ff5e7e94a86214246579d.tar.gz rneovim-d6247a575c12f413e21ff5e7e94a86214246579d.tar.bz2 rneovim-d6247a575c12f413e21ff5e7e94a86214246579d.zip |
vim-patch:8.2.5066: lcs-leadmultispace
https://github.com/vim/vim/commit/aca12fd89b082dd9cc12ae085a84f1805747bbdf
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fe306f8c6b..fb7e34214f 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2453,6 +2453,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc if (wp->w_p_list && !has_fold && !end_fill) { if (wp->w_p_lcs_chars.space || wp->w_p_lcs_chars.multispace != NULL + || wp->w_p_lcs_chars.leadmultispace != NULL || wp->w_p_lcs_chars.trail || wp->w_p_lcs_chars.lead || wp->w_p_lcs_chars.nbsp) { @@ -2467,7 +2468,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc trailcol += (colnr_T)(ptr - line); } // find end of leading whitespace - if (wp->w_p_lcs_chars.lead) { + if (wp->w_p_lcs_chars.lead || wp->w_p_lcs_chars.leadmultispace != NULL) { leadcol = 0; while (ascii_iswhite(ptr[leadcol])) { leadcol++; @@ -3441,8 +3442,20 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc if ((trailcol != MAXCOL && ptr > line + trailcol && c == ' ') || (leadcol != 0 && ptr < line + leadcol && c == ' ')) { - c = (ptr > line + trailcol) ? wp->w_p_lcs_chars.trail - : wp->w_p_lcs_chars.lead; + if (leadcol != 0 && in_multispace && ptr < line + leadcol + && wp->w_p_lcs_chars.leadmultispace != NULL) { + c = wp->w_p_lcs_chars.leadmultispace[multispace_pos++]; + if (wp->w_p_lcs_chars.leadmultispace[multispace_pos] == NUL) { + multispace_pos = 0; + } + } else if (ptr > line + trailcol && wp->w_p_lcs_chars.trail) { + c = wp->w_p_lcs_chars.trail; + } else if (ptr < line + leadcol && wp->w_p_lcs_chars.lead) { + c = wp->w_p_lcs_chars.lead; + } else if (leadcol != 0 && c == ' ' && wp->w_p_lcs_chars.space) { + c = wp->w_p_lcs_chars.space; + } + n_attr = 1; extra_attr = win_hl_attr(wp, HLF_0); saved_attr2 = char_attr; // save current attr |