From 4fc2dfd54151b7d14374692715c8af0b0590ac8d Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 05:50:50 +0800 Subject: [PATCH] fix(search): mark a match count that hit the ceiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scrollback scan stops at 10,000 matches. The count rendered that as "1/10000", which reads as the whole truth — a search for a common letter looked like it had found every occurrence and settled on a round number. It now reads "1/10000+" once the ceiling is reached, the same way every search that caps says so. --- src/terminal/search.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/terminal/search.rs b/src/terminal/search.rs index 7dabd90b..117181d6 100644 --- a/src/terminal/search.rs +++ b/src/terminal/search.rs @@ -276,11 +276,17 @@ impl TerminalView { } else { 0 }; + // The scan stops at MAX_MATCHES. Without the mark, a query that hit + // the ceiling reads as if the scrollback held exactly that many. + let more = match total >= MAX_MATCHES { + true => "+", + false => "", + }; div() .flex_none() .text_xs() .text_color(muted) - .child(format!("{current}/{total}")) + .child(format!("{current}/{total}{more}")) }); let case_toggle = Button::new("search-case") @@ -733,6 +739,19 @@ pub(super) fn is_url_char(c: char) -> bool { mod tests { use super::*; + #[test] + fn a_capped_match_count_says_it_is_capped() { + // Same rule the count uses. Below the ceiling the number is the truth; + // at the ceiling it is a floor, and has to read like one. + let mark = |total: usize| match total >= MAX_MATCHES { + true => "+", + false => "", + }; + assert_eq!(mark(0), ""); + assert_eq!(mark(MAX_MATCHES - 1), ""); + assert_eq!(mark(MAX_MATCHES), "+"); + } + #[test] fn regex_escape_neutralizes_metacharacters() { assert_eq!(regex_escape("a.b*c"), r"a\.b\*c");