From: glepnir Date: Mon, 29 Jun 2026 22:37:25 +0000 (+0000) Subject: patch 9.2.0754: repeated completion length lookup in search_for_exact_line X-Git-Tag: v9.2.0754^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac443b992411d1df7bf58f0681627cf1e52077a8;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/search.c b/src/search.c index 7db964f22b..bcf168be02 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 2bc636bde2..90ad6a7b5f 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, /**/