1
0
forked from aniani/vim

patch 9.1.0377: Formatting text wrong when 'breakindent' is set

Problem:  formatting text wrong when 'breakindent' is set
          (Gary Johnson)
Solution: temporarily disable 'breakindent' option when formatting text,
          so that the breakindent is not wrongly taken into account for
          the line length

fixes: #14630
closes: #14637

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-04-27 11:55:08 +02:00
parent 92917069b1
commit 86ef815959
3 changed files with 29 additions and 0 deletions

View File

@@ -59,9 +59,11 @@ internal_format(
int safe_tw = trim_to_int(8 * (vimlong_T)textwidth);
#ifdef FEAT_LINEBREAK
int has_lbr = curwin->w_p_lbr;
int has_bri = curwin->w_p_bri;
// make sure win_lbr_chartabsize() counts correctly
curwin->w_p_lbr = FALSE;
curwin->w_p_bri = FALSE;
#endif
// When 'ai' is off we don't want a space under the cursor to be
@@ -475,6 +477,7 @@ internal_format(
#ifdef FEAT_LINEBREAK
curwin->w_p_lbr = has_lbr;
curwin->w_p_bri = has_bri;
#endif
if (!format_only && haveto_redraw)
{