summaryrefslogtreecommitdiffstats
path: root/alacritty_terminal
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-07-15 21:27:32 +0000
committerGitHub <noreply@github.com>2020-07-15 21:27:32 +0000
commit142f84efb955a9fa59f4205ec3a6db3964c5f433 (patch)
tree450d1f210dd961de872f8105cdb4290a13194d97 /alacritty_terminal
parentd868848ef162ce1d2d5e41b690a592199e9f652d (diff)
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')
-rw-r--r--alacritty_terminal/src/grid/mod.rs2
-rw-r--r--alacritty_terminal/src/grid/tests.rs4
-rw-r--r--alacritty_terminal/src/term/mod.rs13
-rw-r--r--alacritty_terminal/src/term/search.rs8
4 files changed, 10 insertions, 17 deletions
diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs
index c1f980e8..5ab25c78 100644
--- a/alacritty_terminal/src/grid/mod.rs
+++ b/alacritty_terminal/src/grid/mod.rs
@@ -252,7 +252,7 @@ impl<T: GridCell + Default + PartialEq + Copy> Grid<T> {
}
}
- /// Move lines at the bottom towards the top.
+ /// Move lines at the bottom toward the top.
///
/// This is the performance-sensitive part of scrolling.
pub fn scroll_up(&mut self, region: &Range<Line>, positions: Line, template: T) {
diff --git a/alacritty_terminal/src/grid/tests.rs b/alacritty_terminal/src/grid/tests.rs
index 1ed279a0..f86c77b5 100644
--- a/alacritty_terminal/src/grid/tests.rs
+++ b/alacritty_terminal/src/grid/tests.rs
@@ -56,7 +56,7 @@ fn visible_to_buffer() {
assert_eq!(point, Point::new(4, Column(3)));
}
-// Scroll up moves lines upwards.
+// Scroll up moves lines upward.
#[test]
fn scroll_up() {
let mut grid = Grid::new(Line(10), Column(1), 0, 0);
@@ -88,7 +88,7 @@ fn scroll_up() {
assert_eq!(grid[Line(9)].occ, 0);
}
-// Scroll down moves lines downwards.
+// Scroll down moves lines downward.
#[test]
fn scroll_down() {
let mut grid = Grid::new(Line(10), Column(1), 0, 0);
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 5a59b55b..91748359 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -725,7 +725,7 @@ pub struct Term<T> {
/// term is set.
title_stack: Vec<Option<String>>,
- /// Current forwards and backwards buffer search regexes.
+ /// Current forward and backward buffer search regexes.
regex_search: Option<RegexSearch>,
}
@@ -1115,13 +1115,6 @@ impl<T> Term<T> {
self.dirty = true;
}
- /// Start vi mode without moving the cursor.
- #[inline]
- pub fn set_vi_mode(&mut self) {
- self.mode.insert(TermMode::VI);
- self.dirty = true;
- }
-
/// Move vi mode cursor.
#[inline]
pub fn vi_motion(&mut self, motion: ViMotion)
@@ -1466,8 +1459,8 @@ impl<T: EventListener> Handler for Term<T> {
ptr::copy(src, dst, num_cells);
}
- // Cells were just moved out towards the end of the line; fill in
- // between source and dest with blanks.
+ // Cells were just moved out toward the end of the line;
+ // fill in between source and dest with blanks.
for c in &mut line[source..destination] {
c.reset(&cursor.template);
}
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));