mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-08 16:55:01 +00:00
AK: Make StringUtils::matches() handle escaping correctly
Previously any backslash and the character following it were ignored. This commit adds a fall through to match the character following the backslash without checking whether it is "special".
This commit is contained in:
committed by
Ali Mohammad Pur
parent
0e26f2657e
commit
af2ffcaba8
@@ -62,8 +62,11 @@ bool matches(StringView str, StringView mask, CaseSensitivity case_sensitivity,
|
||||
record_span(string_ptr - string_start, 1);
|
||||
break;
|
||||
case '\\':
|
||||
++mask_ptr;
|
||||
break;
|
||||
// if backslash is last character in mask, just treat it as an exact match
|
||||
// otherwise use it as escape for next character
|
||||
if (mask_ptr + 1 < mask_end)
|
||||
++mask_ptr;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
auto p = *mask_ptr;
|
||||
auto ch = *string_ptr;
|
||||
|
||||
Reference in New Issue
Block a user