summaryrefslogtreecommitdiffstats
path: root/src/textformat.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:59 +0000
commitcccb21df3b4c6fe0aaa99743c418aa973aeebad0 (patch)
tree35a2d1f88d47e930fec425da1c1cb89b3ccae6e0 /src/textformat.c
parentReleasing progress-linux version 2:9.1.0199-1~progress7.99u1. (diff)
downloadvim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.tar.xz
vim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.zip
Merging upstream version 2:9.1.0374.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/textformat.c')
-rw-r--r--src/textformat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/textformat.c b/src/textformat.c
index 14acc53..41ec2cf 100644
--- a/src/textformat.c
+++ b/src/textformat.c
@@ -56,6 +56,7 @@ internal_format(
colnr_T leader_len;
int no_leader = FALSE;
int do_comments = (flags & INSCHAR_DO_COM);
+ int safe_tw = trim_to_int(8 * (vimlong_T)textwidth);
#ifdef FEAT_LINEBREAK
int has_lbr = curwin->w_p_lbr;
@@ -95,7 +96,7 @@ internal_format(
// Cursor is currently at the end of line. No need to format
// if line length is less than textwidth (8 * textwidth for
// utf safety)
- if (curwin->w_cursor.col < 8 * textwidth)
+ if (curwin->w_cursor.col < safe_tw)
{
virtcol = get_nolist_virtcol()
+ char2cells(c != NUL ? c : gchar_cursor());
@@ -156,8 +157,7 @@ internal_format(
// line to textwidth border every time for each line break.
//
// Ceil to 8 * textwidth to optimize.
- curwin->w_cursor.col = startcol < 8 * textwidth ? startcol :
- 8 * textwidth;
+ curwin->w_cursor.col = startcol < safe_tw ? startcol : safe_tw;
foundcol = 0;
skip_pos = 0;