diff --git a/src/frontend/gui/search.rs b/src/frontend/gui/search.rs index d7bb9577f..072000f36 100644 --- a/src/frontend/gui/search.rs +++ b/src/frontend/gui/search.rs @@ -1,7 +1,7 @@ use crate::frontend::gui::termwindow::TermWindow; use crate::mux::domain::DomainId; use crate::mux::renderable::*; -use crate::mux::tab::{Pattern, SearchDirection, SearchResult}; +use crate::mux::tab::{Pattern, SearchResult}; use crate::mux::tab::{Tab, TabId}; use portable_pty::PtySize; use rangeset::RangeSet; @@ -190,12 +190,7 @@ impl Tab for SearchOverlay { self.delegate.erase_scrollback() } - fn search( - &self, - _row: StableRowIndex, - _direction: SearchDirection, - _pattern: &Pattern, - ) -> Vec { + fn search(&self, _pattern: &Pattern) -> Vec { // You can't search the search bar vec![] } @@ -297,11 +292,7 @@ impl SearchRenderable { self.dirty_results.add(bar_pos); if !self.pattern.is_empty() { - self.results = self.delegate.search( - bar_pos + 1, - SearchDirection::Backwards, - &Pattern::String(self.pattern.clone()), - ); + self.results = self.delegate.search(&Pattern::String(self.pattern.clone())); self.results.sort(); self.recompute_results(); diff --git a/src/localtab.rs b/src/localtab.rs index 0e715ecbe..382edb427 100644 --- a/src/localtab.rs +++ b/src/localtab.rs @@ -1,7 +1,7 @@ use crate::mux::domain::DomainId; use crate::mux::renderable::Renderable; use crate::mux::tab::{alloc_tab_id, Tab, TabId}; -use crate::mux::tab::{Pattern, SearchDirection, SearchResult}; +use crate::mux::tab::{Pattern, SearchResult}; use anyhow::Error; use portable_pty::{Child, MasterPty, PtySize}; use std::cell::{RefCell, RefMut}; @@ -104,12 +104,7 @@ impl Tab for LocalTab { self.terminal.borrow().get_current_dir().cloned() } - fn search( - &self, - _row: StableRowIndex, - _direction: SearchDirection, - pattern: &Pattern, - ) -> Vec { + fn search(&self, pattern: &Pattern) -> Vec { let term = self.terminal.borrow(); let screen = term.screen(); diff --git a/src/mux/tab.rs b/src/mux/tab.rs index 3bd172a8f..b3b7e5ee0 100644 --- a/src/mux/tab.rs +++ b/src/mux/tab.rs @@ -49,12 +49,6 @@ pub enum Pattern { // Regex(regex::Regex), } -#[derive(Debug, Clone, Copy, Eq, PartialEq)] -pub enum SearchDirection { - Backwards, - // Forwards, -} - #[derive(Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)] pub struct SearchResult { pub start_y: StableRowIndex, @@ -80,20 +74,10 @@ pub trait Tab: Downcast { fn erase_scrollback(&self) {} - /// Performs a search relative to the specified stable row index. - /// if direction is Backwards then the search proceeds to smaller - /// values of StableRowIndex. Forwards towards larger values. - /// If the result is empty then there are no matches in the specified - /// direction. - /// Otherwise, the result shall contain at least as many matches will - /// be visible in the current viewport, starting from the first match. - /// It may return matches outside that range. - fn search( - &self, - _row: StableRowIndex, - _direction: SearchDirection, - _pattern: &Pattern, - ) -> Vec { + /// Performs a search. + /// If the result is empty then there are no matches. + /// Otherwise, the result shall contain all possible matches. + fn search(&self, _pattern: &Pattern) -> Vec { vec![] }