mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 21:55:11 +02: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
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) {
|
pub fn on_char_key(&mut self, caught_char: char) {
|
||||||
// Forbid any char key presses when showing a dialog box...
|
// Forbid any char key presses when showing a dialog box...
|
||||||
if !self.is_in_dialog() {
|
if !self.is_in_dialog() {
|
||||||
|
@ -256,6 +256,8 @@ fn main() -> error::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyCode::Char('s') => app.toggle_simple_search(),
|
KeyCode::Char('s') => app.toggle_simple_search(),
|
||||||
|
KeyCode::Char('a') => app.skip_cursor_beginning(),
|
||||||
|
KeyCode::Char('e') => app.skip_cursor_end(),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user