diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-10 13:27:41 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-10 15:50:43 +0100 |
commit | fd1dbb103bb78f04dd15b50f529bb12d922e98eb (patch) | |
tree | ec13311830303ad6900d5b47dc556fd9c857c8fc /src/nvim/plines.c | |
parent | aab3583e74fa3fd295bd367113be60965c748205 (diff) | |
download | rneovim-fd1dbb103bb78f04dd15b50f529bb12d922e98eb.tar.gz rneovim-fd1dbb103bb78f04dd15b50f529bb12d922e98eb.tar.bz2 rneovim-fd1dbb103bb78f04dd15b50f529bb12d922e98eb.zip |
vim-patch:8.1.2281: 'showbreak' cannot be set for one window
Problem: 'showbreak' cannot be set for one window.
Solution: Make 'showbreak' global-local.
https://github.com/vim/vim/commit/ee85702c10495041791f728e977b86005c4496e8
Change in oneleft() is N/A as the relevant condition was removed
(has_mbyte is always true for Nvim, so the condition was always false;
see commit 73dc9e9).
Use wp over curwin for curs_columns().
Required for v8.2.2903 (otherwise test fails as it'll leave the global
option set).
N/A patches for version.c:
vim-patch:8.1.2283: missed on use of p_sbr
Problem: Missed on use of p_sbr.
Solution: Add missing p_sbr change.
https://github.com/vim/vim/commit/91e22eb6e09ec384496fccde812072033fd9e616
Already ported in commit 43a874a.
Diffstat (limited to 'src/nvim/plines.c')
-rw-r--r-- | src/nvim/plines.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c index 6718b7f7a4..a656686a95 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -263,7 +263,8 @@ unsigned int win_linetabsize(win_T *wp, char_u *line, colnr_T len) /// @return The number of characters taken up on the screen. int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col) { - if (!curwin->w_p_lbr && (*p_sbr == NUL) && !curwin->w_p_bri) { + if (!curwin->w_p_lbr && *get_showbreak_value(curwin) == NUL + && !curwin->w_p_bri) { if (curwin->w_p_wrap) { return win_nolbr_chartabsize(curwin, s, col, NULL); } @@ -314,7 +315,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, int n; // No 'linebreak', 'showbreak' and 'breakindent': return quickly. - if (!wp->w_p_lbr && !wp->w_p_bri && (*p_sbr == NUL)) { + if (!wp->w_p_lbr && !wp->w_p_bri && *get_showbreak_value(wp) == NUL) { if (wp->w_p_wrap) { return win_nolbr_chartabsize(wp, s, col, headp); } @@ -381,7 +382,8 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, // Set *headp to the size of what we add. added = 0; - if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && (col != 0)) { + char_u *const sbr = get_showbreak_value(wp); + if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0) { colnr_T sbrlen = 0; int numberwidth = win_col_off(wp); @@ -394,8 +396,8 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, if (col >= numberextra && numberextra > 0) { col %= numberextra; } - if (*p_sbr != NUL) { - sbrlen = (colnr_T)MB_CHARLEN(p_sbr); + if (*sbr != NUL) { + sbrlen = (colnr_T)MB_CHARLEN(sbr); if (col >= sbrlen) { col -= sbrlen; } @@ -410,7 +412,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, } if (col == 0 || (col + size + sbrlen > (colnr_T)wp->w_width_inner)) { - if (*p_sbr != NUL) { + if (*sbr != NUL) { if (size + sbrlen + numberwidth > (colnr_T)wp->w_width_inner) { // Calculate effective window width. int width = (colnr_T)wp->w_width_inner - sbrlen - numberwidth; @@ -420,13 +422,13 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, if (width <= 0) { width = 1; } - added += ((size - prev_width) / width) * vim_strsize(p_sbr); + added += ((size - prev_width) / width) * vim_strsize(sbr); if ((size - prev_width) % width) { // Wrapped, add another length of 'sbr'. - added += vim_strsize(p_sbr); + added += vim_strsize(sbr); } } else { - added += vim_strsize(p_sbr); + added += vim_strsize(sbr); } } |