search: use case insensitive search only if there's no uppercase in search

This commit is contained in:
c4llv07e 2025-10-27 13:25:48 +03:00 committed by Daniel Eklöf
parent 71de0c45bc
commit 5ae4955e83
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 9 additions and 2 deletions

View file

@ -100,6 +100,8 @@
e.g. integrated graphics ([#2182][2182]). e.g. integrated graphics ([#2182][2182]).
* Jump label colors in the modus-operandi theme, for improved * Jump label colors in the modus-operandi theme, for improved
readability. readability.
* Scrollback search is now case sensitive when the search string
contains at least one upper case character.
[2182]: https://codeberg.org/dnkl/foot/issues/2182 [2182]: https://codeberg.org/dnkl/foot/issues/2182

View file

@ -283,8 +283,13 @@ matches_cell(const struct terminal *term, const struct cell *cell, size_t search
if (composed == NULL && base == 0 && term->search.buf[search_ofs] == U' ') if (composed == NULL && base == 0 && term->search.buf[search_ofs] == U' ')
return 1; return 1;
if (c32ncasecmp(&base, &term->search.buf[search_ofs], 1) != 0) if (hasc32upper(term->search.buf)) {
return -1; if (c32ncmp(&base, &term->search.buf[search_ofs], 1) != 0)
return -1;
} else {
if (c32ncasecmp(&base, &term->search.buf[search_ofs], 1) != 0)
return -1;
}
if (composed != NULL) { if (composed != NULL) {
if (search_ofs + composed->count > term->search.len) if (search_ofs + composed->count > term->search.len)