summaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2023-10-11 21:51:19 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-11 21:53:52 +0200
commitdd75fcfbdff1934c6e531b5a89ebc636318bf4a2 (patch)
tree06026fecb12cc7d18acc8e41f34a5ec2fee2f77e /src/charset.c
parent1ea428883f16838aca5763aee156fde3929d9ab6 (diff)
patch 9.0.2017: linebreak applies for leading whitespacev9.0.2017
Problem: linebreak applies for leading whitespace Solution: only apply linebreak, once we have found non-breakat chars in the line closes: #13228 closes: #13243 Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c
index dc8fa44833..50a81cccd9 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1123,6 +1123,7 @@ win_lbr_chartabsize(
int n;
char_u *sbr;
int no_sbr = FALSE;
+ colnr_T vcol_start = 0; // start from where to consider linebreak
#endif
#if defined(FEAT_PROP_POPUP)
@@ -1344,7 +1345,14 @@ win_lbr_chartabsize(
* 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 != 0)
+ {
+ char_u *t = cts->cts_line;
+ while (VIM_ISBREAK((int)*t))
+ t++;
+ vcol_start = t - cts->cts_line;
+ }
+ if (wp->w_p_lbr && vcol_start <= vcol
&& VIM_ISBREAK((int)s[0])
&& !VIM_ISBREAK((int)s[1])
&& wp->w_p_wrap