0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

patch 9.1.1700: Multiline ignorecase specific pattern does not match with 'ignorecase'

Problem:  a pattern that involves a backref on a different line does not
          match when 'ignorecase' is set (QiWei, after v9.1.0645)
Solution: Use MB_STRNICMP when ignorecase is set, fix tests to close
          swapfiles

related: #14756
fixes: #17470
closes: #18104

Signed-off-by: author
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-08-27 18:14:27 +02:00
parent cadba05329
commit bf82e58a70
3 changed files with 26 additions and 5 deletions

View File

@@ -1569,6 +1569,7 @@ reg_nextline(void)
* Returns RA_FAIL, RA_NOMATCH or RA_MATCH.
* If "bytelen" is not NULL, it is set to the byte length of the match in the
* last line.
* Optional: ignore case if rex.reg_ic is set.
*/
static int
match_with_backref(
@@ -1613,7 +1614,9 @@ match_with_backref(
else
len = (int)reg_getline_len(clnum) - ccol;
if (cstrncmp(p + ccol, rex.input, &len) != 0)
// Use case-insensitive compare if rex.reg_ic is set
if ((!rex.reg_ic && cstrncmp(p + ccol, rex.input, &len) != 0)
|| (rex.reg_ic && MB_STRNICMP(p + ccol, rex.input, len) != 0))
return RA_NOMATCH; // doesn't match
if (bytelen != NULL)
*bytelen += len;