diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-07-15 21:27:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-15 21:27:32 +0000 |
commit | 142f84efb955a9fa59f4205ec3a6db3964c5f433 (patch) | |
tree | 450d1f210dd961de872f8105cdb4290a13194d97 /alacritty_terminal/src/term/search.rs | |
parent | d868848ef162ce1d2d5e41b690a592199e9f652d (diff) | |
download | alacritty-142f84efb955a9fa59f4205ec3a6db3964c5f433.tar.gz alacritty-142f84efb955a9fa59f4205ec3a6db3964c5f433.zip |
Add support for searching without vi mode
This implements search without vi mode by using the selection to track
the active search match and advancing it on user input. The keys to go
to the next or previous match are not configurable and are bound to
enter and shift enter based on Firefox's behavior.
Fixes #3937.
Diffstat (limited to 'alacritty_terminal/src/term/search.rs')
-rw-r--r-- | alacritty_terminal/src/term/search.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs index b1766b05..a6664054 100644 --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -28,7 +28,7 @@ pub struct RegexSearch { } impl RegexSearch { - /// Build the forwards and backwards search DFAs. + /// Build the forward and backward search DFAs. pub fn new(search: &str) -> Result<RegexSearch, RegexError> { // Check case info for smart case let has_uppercase = search.chars().any(|c| c.is_uppercase()); @@ -318,7 +318,7 @@ impl<T> Term<T> { let start_char = self.grid[point.line][point.col].c; // Find the matching bracket we're looking for - let (forwards, end_char) = BRACKET_PAIRS.iter().find_map(|(open, close)| { + let (forward, end_char) = BRACKET_PAIRS.iter().find_map(|(open, close)| { if open == &start_char { Some((true, *close)) } else if close == &start_char { @@ -336,7 +336,7 @@ impl<T> Term<T> { loop { // Check the next cell - let cell = if forwards { iter.next() } else { iter.prev() }; + let cell = if forward { iter.next() } else { iter.prev() }; // Break if there are no more cells let c = match cell { @@ -633,7 +633,7 @@ mod tests { fn reverse_search_dead_recovery() { let mut term = mock_term("zooo lense"); - // Make sure the reverse DFA operates the same as a forwards DFA. + // Make sure the reverse DFA operates the same as a forward DFA. term.regex_search = Some(RegexSearch::new("zoo").unwrap()); let start = Point::new(0, Column(9)); let end = Point::new(0, Column(0)); |