1
0
forked from aniani/vim

patch 9.0.2017: linebreak applies for leading whitespace

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>
This commit is contained in:
Christian Brabandt
2023-10-11 21:51:19 +02:00
parent 1ea428883f
commit dd75fcfbdf
4 changed files with 49 additions and 2 deletions

View File

@@ -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