mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-22 20:23:12 +00:00
Add Ctrl-A and Ctrl-E for searching to skip around to start and end respectively.
This commit is contained in:
parent
7e442330ba
commit
4c7b3ee239
2 changed files with 18 additions and 0 deletions
16
src/app.rs
16
src/app.rs
|
@ -319,6 +319,22 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn skip_cursor_beginning(&mut self) {
|
||||
if !self.is_in_dialog() {
|
||||
if let ApplicationPosition::ProcessSearch = self.current_application_position {
|
||||
self.current_cursor_position = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn skip_cursor_end(&mut self) {
|
||||
if !self.is_in_dialog() {
|
||||
if let ApplicationPosition::ProcessSearch = self.current_application_position {
|
||||
self.current_cursor_position = self.current_search_query.len();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_char_key(&mut self, caught_char: char) {
|
||||
// Forbid any char key presses when showing a dialog box...
|
||||
if !self.is_in_dialog() {
|
||||
|
|
|
@ -256,6 +256,8 @@ fn main() -> error::Result<()> {
|
|||
}
|
||||
}
|
||||
KeyCode::Char('s') => app.toggle_simple_search(),
|
||||
KeyCode::Char('a') => app.skip_cursor_beginning(),
|
||||
KeyCode::Char('e') => app.skip_cursor_end(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue