pub struct SearchState {
pub pattern: Option<Regex>,
pub forward: bool,
pub matches: Vec<Vec<(usize, usize)>>,
pub generations: Vec<u64>,
pub wrap_around: bool,
}Expand description
Per-row match cache keyed against the buffer’s dirty_gen. Live
alongside the active pattern so re-running n doesn’t re-scan
rows the buffer hasn’t touched.
Fields§
§pattern: Option<Regex>Active pattern, if any. None clears highlighting and makes
n / N no-op until the next / / ? commit.
forward: booltrue for /, false for ? — drives n vs N direction.
Mirrors vim.last_search_forward; consolidated so future
patches can drop the duplicate.
matches: Vec<Vec<(usize, usize)>>matches[row] is the (byte_start, byte_end) runs cached on
row, captured at gen[row]. Length grows lazily.
generations: Vec<u64>Per-row generation tag. When the buffer’s dirty_gen for a
row diverges, the row gets re-scanned on next access.
wrap_around: boolWrap past buffer ends. Mirrors Settings::wrapscan.
Implementations§
Source§impl SearchState
impl SearchState
Sourcepub fn set_pattern(&mut self, re: Option<Regex>)
pub fn set_pattern(&mut self, re: Option<Regex>)
Replace the active pattern. Drops the cached match runs so the next access re-scans against the new regex.
Trait Implementations§
Source§impl Clone for SearchState
impl Clone for SearchState
Source§fn clone(&self) -> SearchState
fn clone(&self) -> SearchState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more