patch 9.2.0754: repeated completion length lookup in search_for_exact_line
Commit:
https://github.com/vim/vim/commit/ac443b992411d1df7bf58f0681627cf1e52077a8
Author: glepnir <
gleph...@gmail.com>
Date: Mon Jun 29 22:37:25 2026 +0000
patch 9.2.0754: repeated completion length lookup in search_for_exact_line
Problem: search_for_exact_line() repeatedly calls ins_compl_len() and
relies on ternary operator precedence.
Solution: Cache the completion length and parenthesize the ternary
expression.
closes: #20678
Signed-off-by: glepnir <
gleph...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/search.c b/src/search.c
index 7db964f22..bcf168be0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1788,6 +1788,7 @@ search_for_exact_line(
linenr_T start = 0;
char_u *ptr;
char_u *p;
+ int compl_len = ins_compl_len();
if (buf->b_ml.ml_line_count == 0)
return FAIL;
@@ -1839,8 +1840,8 @@ search_for_exact_line(
}
else if (*p != NUL) // ignore empty lines
{ // expanding lines or words
- if ((p_ic ? MB_STRNICMP(p, pat, ins_compl_len())
- : STRNCMP(p, pat, ins_compl_len())) == 0)
+ if ((p_ic ? MB_STRNICMP(p, pat, compl_len)
+ : STRNCMP(p, pat, compl_len)) == 0)
return OK;
}
}
@@ -3005,8 +3006,8 @@ is_zero_width(
if (nmatched != 0)
break;
} while (regmatch.regprog != NULL
- && direction == FORWARD ? regmatch.startpos[0].col < pos.col
- : regmatch.startpos[0].col > pos.col);
+ && (direction == FORWARD ? regmatch.startpos[0].col < pos.col
+ : regmatch.startpos[0].col > pos.col));
if (called_emsg == called_emsg_before)
{
diff --git a/src/version.c b/src/version.c
index 2bc636bde..90ad6a7b5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 754,
/**/
753,
/**/