pub struct FindReplaceState {
pub query: String,
pub replacement: String,
pub case_sensitive: bool,
pub whole_word: bool,
pub use_regex: bool,
pub is_open: bool,
pub show_replace: bool,
pub active_match_index: usize,
pub matches: Vec<SearchMatch>,
pub regex_error: Option<String>,
}Expand description
Interactive Find & Replace controller state.
Fields§
§query: String§replacement: String§case_sensitive: bool§whole_word: bool§use_regex: bool§is_open: bool§show_replace: bool§active_match_index: usize§matches: Vec<SearchMatch>§regex_error: Option<String>Implementations§
Source§impl FindReplaceState
impl FindReplaceState
pub fn new() -> Self
pub fn open_find(&mut self)
pub fn open_replace(&mut self)
pub fn close(&mut self)
pub fn set_query(&mut self, query: impl Into<String>, buffer: &LineBuffer)
pub fn set_replacement(&mut self, replacement: impl Into<String>)
pub fn toggle_case_sensitive(&mut self, buffer: &LineBuffer)
pub fn toggle_whole_word(&mut self, buffer: &LineBuffer)
pub fn toggle_regex(&mut self, buffer: &LineBuffer)
Sourcepub fn recompute_matches(&mut self, buffer: &LineBuffer)
pub fn recompute_matches(&mut self, buffer: &LineBuffer)
Recomputes all matches across buffer cleanly with Unicode char-column accuracy.
Sourcepub fn active_match(&self) -> Option<&SearchMatch>
pub fn active_match(&self) -> Option<&SearchMatch>
Returns the currently focused match, if any.
Sourcepub fn find_next(&mut self) -> Option<SearchMatch>
pub fn find_next(&mut self) -> Option<SearchMatch>
Advances to the next match (wrapping around to match 0).
Sourcepub fn find_prev(&mut self) -> Option<SearchMatch>
pub fn find_prev(&mut self) -> Option<SearchMatch>
Moves to the previous match (wrapping around to the last match).
Sourcepub fn select_nearest_after(&mut self, pos: Position) -> Option<SearchMatch>
pub fn select_nearest_after(&mut self, pos: Position) -> Option<SearchMatch>
Moves active_match_index to the first match starting at or after pos.
Sourcepub fn matches_on_line(&self, line: usize) -> Vec<(usize, &SearchMatch)>
pub fn matches_on_line(&self, line: usize) -> Vec<(usize, &SearchMatch)>
Binary-searches all matches on logical line, returning (match_index, &SearchMatch).
Sourcepub fn replace_current(&mut self, editor: &mut CodeEditor) -> bool
pub fn replace_current(&mut self, editor: &mut CodeEditor) -> bool
Replaces the active match in editor, recomputes matches, and selects the next match.
Sourcepub fn replace_all(&mut self, editor: &mut CodeEditor) -> usize
pub fn replace_all(&mut self, editor: &mut CodeEditor) -> usize
Replaces every match in editor as ONE atomic undo transaction and single incremental reparse.
Sourcepub fn status_label(&self) -> String
pub fn status_label(&self) -> String
Formats a Monaco-style status label like "2 of 14" or "No results".
Trait Implementations§
Source§impl Clone for FindReplaceState
impl Clone for FindReplaceState
Source§impl Debug for FindReplaceState
impl Debug for FindReplaceState
Source§impl Default for FindReplaceState
impl Default for FindReplaceState
Source§impl<'de> Deserialize<'de> for FindReplaceState
impl<'de> Deserialize<'de> for FindReplaceState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for FindReplaceState
impl Freeze for FindReplaceState
impl Move for FindReplaceState
impl RefUnwindSafe for FindReplaceState
impl Send for FindReplaceState
impl Sync for FindReplaceState
impl Unpin for FindReplaceState
impl UnsafeUnpin for FindReplaceState
impl UnwindSafe for FindReplaceState
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
Mutably borrows from an owned value. Read more