From 3a6e45bab5fa68f6192a73538d5c80b735b532ca Mon Sep 17 00:00:00 2001 From: zeng11 <1957910297@qq.com> Date: Thu, 28 Nov 2024 20:53:45 +0800 Subject: [PATCH] add textformat.c file --- src/textformat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/textformat.c b/src/textformat.c index a1a3e16..1aa42de 100644 --- a/src/textformat.c +++ b/src/textformat.c @@ -540,6 +540,9 @@ same_leader( if (leader1_len == 0) return (leader2_len == 0); + char_u *lnum_line = NULL; + int line_len = 0; + // If first leader has 'f' flag, the lines can be joined only if the // second line does not have a leader. // If first leader has 'e' flag, the lines can never be joined. @@ -555,7 +558,11 @@ same_leader( return FALSE; if (*p == COM_START) { - int line_len = (int)STRLEN(ml_get(lnum)); + if (lnum_line == NULL) + { + lnum_line = ml_get(lnum); + line_len = (int)STRLEN(lnum_line); + } if (line_len <= leader1_len) return FALSE; if (leader2_flags == NULL || leader2_len == 0) -- Gitee