aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-12 06:49:11 +0800
committerGitHub <noreply@github.com>2023-10-12 06:49:11 +0800
commite2406d119f12bd3d2d35710ff6368c828deecdbd (patch)
tree347370924ea501b0ace371dd2c0283f05bb2f865 /src
parent7474874baa3ea960fab38b66db36870b797afd5b (diff)
downloadrneovim-e2406d119f12bd3d2d35710ff6368c828deecdbd.tar.gz
rneovim-e2406d119f12bd3d2d35710ff6368c828deecdbd.tar.bz2
rneovim-e2406d119f12bd3d2d35710ff6368c828deecdbd.zip
vim-patch:9.0.2017: linebreak applies for leading whitespace (#25604)
Problem: linebreak applies for leading whitespace Solution: only apply linebreak, once we have found non-breakat chars in the line closes: vim/vim#13228 closes: vim/vim#13243 https://github.com/vim/vim/commit/dd75fcfbdff1934c6e531b5a89ebc636318bf4a2 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/plines.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index 97782b39bc..2b8cdd4ad9 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -340,9 +340,17 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
*headp = head;
}
+ colnr_T vcol_start = 0; // start from where to consider linebreak
// If 'linebreak' set check at a blank before a non-blank if the line
// needs a break here
- if (wp->w_p_lbr
+ if (wp->w_p_lbr && wp->w_p_wrap && wp->w_width_inner != 0) {
+ char *t = cts->cts_line;
+ while (vim_isbreak((uint8_t)(*t))) {
+ t++;
+ }
+ vcol_start = (colnr_T)(t - cts->cts_line);
+ }
+ if (wp->w_p_lbr && vcol_start <= vcol
&& vim_isbreak((uint8_t)s[0])
&& !vim_isbreak((uint8_t)s[1])
&& wp->w_p_wrap