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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SearchState
impl Debug for SearchState
Source§impl Default for SearchState
impl Default for SearchState
Source§fn default() -> SearchState
fn default() -> SearchState
Auto Trait Implementations§
impl Freeze for SearchState
impl RefUnwindSafe for SearchState
impl Send for SearchState
impl Sync for SearchState
impl Unpin for SearchState
impl UnsafeUnpin for SearchState
impl UnwindSafe for SearchState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more