pub fn terminal_search_matches(
lines: &[TerminalLine],
query: &str,
case_sensitive: bool,
) -> Vec<TerminalSearchMatch>Expand description
Finds non-overlapping exact substring matches in line order.
Results use UTF-8 byte offsets with inclusive start and exclusive end.
Empty queries return no matches. When case_sensitive is false, both sides
use ASCII lowercase conversion; the query is not trimmed.
ยงExamples
use ailloli_ui_widgets::controls::{terminal_search_matches, TerminalLine};
let lines = [TerminalLine::new("Cargo CHECK"), TerminalLine::new("unchecked")];
let hits = terminal_search_matches(&lines, "check", false);
assert_eq!(hits.iter().map(|hit| hit.line).collect::<Vec<_>>(), vec![0, 1]);
assert!(terminal_search_matches(&lines, "Check", true).is_empty());