summaryrefslogtreecommitdiff
path: root/src/search.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-05 20:41:17 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-05 20:41:17 +0100
commit3d0274d1fefc20dab25657490ba6f1723c3f4632 (patch)
treec941b1f6a65b01588e8811ffcc51bff21193bd0c /src/search.cpp
parent129d8d9a5922eb3d4df9320418fb98dfbbadc053 (diff)
make text-match case insensitive
Diffstat (limited to 'src/search.cpp')
-rw-r--r--src/search.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/search.cpp b/src/search.cpp
index b48b04d..9946423 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -161,6 +161,7 @@ bool ts_string_contains(char *text_to_search, utf8_int8_t *text_to_find, ts_arra
int index = 0;
while ((text_to_search = utf8codepoint(text_to_search, &text_to_search_ch)) && text_to_search_ch)
{
+ text_to_search_ch = utf8lwrcodepoint(text_to_search_ch);
word_offset_val += utf8codepointsize(text_to_search_ch);
if (text_to_search_ch == '\n')
{
@@ -175,6 +176,7 @@ bool ts_string_contains(char *text_to_search, utf8_int8_t *text_to_find, ts_arra
bool in_wildcard = false;
text_to_find = utf8codepoint(text_to_find, &text_to_find_ch);
+ text_to_find_ch = utf8lwrcodepoint(text_to_find_ch);
// text_to_search_current_attempt = utf8codepoint(text_to_search_current_attempt,
//&text_to_search_current_attempt_ch);
@@ -193,6 +195,7 @@ bool ts_string_contains(char *text_to_search, utf8_int8_t *text_to_find, ts_arra
if (text_to_find_ch == '*')
{
text_to_find = utf8codepoint(text_to_find, &text_to_find_ch);
+ text_to_find_ch = utf8lwrcodepoint(text_to_find_ch);
in_wildcard = true;
}
@@ -201,13 +204,16 @@ bool ts_string_contains(char *text_to_search, utf8_int8_t *text_to_find, ts_arra
break;
continue_search:
- if (!in_wildcard)
+ if (!in_wildcard) {
text_to_find = utf8codepoint(text_to_find, &text_to_find_ch);
+ text_to_find_ch = utf8lwrcodepoint(text_to_find_ch);
+ }
word_match_len_val += utf8codepointsize(text_to_search_current_attempt_ch);
text_to_search_current_attempt = utf8codepoint(
text_to_search_current_attempt,
&text_to_search_current_attempt_ch);
+ text_to_search_current_attempt_ch = utf8lwrcodepoint(text_to_search_current_attempt_ch);
if (!text_to_search_current_attempt_ch && !text_to_find_ch)
goto done;