From 5ae4955e834831b5680baaad7c4f974e407ffb7a Mon Sep 17 00:00:00 2001 From: c4llv07e Date: Mon, 27 Oct 2025 13:25:48 +0300 Subject: [PATCH] search: use case insensitive search only if there's no uppercase in search --- CHANGELOG.md | 2 ++ search.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2eebef8..81f7a168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,8 @@ e.g. integrated graphics ([#2182][2182]). * Jump label colors in the modus-operandi theme, for improved 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 diff --git a/search.c b/search.c index dda84e6d..5a2b6236 100644 --- a/search.c +++ b/search.c @@ -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' ') return 1; - if (c32ncasecmp(&base, &term->search.buf[search_ofs], 1) != 0) - return -1; + if (hasc32upper(term->search.buf)) { + 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 (search_ofs + composed->count > term->search.len)