1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Search results. The engine-side entry points are [`crate::Engine::search`] /
//! [`crate::Engine::search_with`]; the consumer owns the query *policy* (ADR-0017).
//!
//! A `Match` is an inclusive range in **absolute buffer coordinates** (a line
//! index into `[scrollback ++ screen]`, the same coordinate the selection model
//! uses). The engine finds matches; the consumer drives next/prev navigation
//! (holding the `Vec<Match>` and calling `scroll_to_match`), mirroring
//! Alacritty's "engine finds, frontend navigates" split.
/// Whether `pattern` is a regex [`Term::search_with`](crate::Term::search_with) can run
/// (`opts.regex = true`) — a `true` guarantees `search_with` will *build* the pattern, and a
/// `false` is exactly the case it silently swallows into an empty result (#316 D2).
///
/// Validated under **case-insensitive** compilation, the most expansive: Unicode case-folding
/// grows the compiled program, so a `true` here holds whichever case mode smart-case / the
/// `case_sensitive` override later picks for the search. A case-*sensitive*-only check could pass
/// a pattern that then exceeds the `regex` size limit under `search_with`'s case-insensitive build
/// (`CompiledTooBig`), reintroducing the silent swallow for an all-lowercase near-limit pattern.
/// Grammar validity itself is case-flag-independent, so an invalid pattern (unbalanced group,
/// lookaround / backreferences the `regex` crate lacks) is rejected regardless.
///
/// A consumer surfaces invalid-regex with this rather than JS `RegExp`: the `regex` crate's grammar
/// differs (no lookaround/backreferences, Unicode-aware `\w \d \b`), so a JS-side check would
/// misjudge patterns and reproduce the D2 gap. Pattern-only (no `SearchOptions`) — the case flag
/// changes only compile size, covered here by validating the worst case.
/// One literal match, inclusive on both ends, in absolute buffer coordinates.
/// Search modes beyond the default literal + smart-case (see [`Term::search_with`](crate::Term::search_with)).
/// Mirrors xterm.js's `ISearchOptions` (#314). The default (all off / smart-case) is exactly
/// [`Term::search`](crate::Term::search).