mirror of
https://github.com/ClementTsang/bottom.git
synced 2024-11-13 08:50:58 +03: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) {
|
||||
// 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 New Issue
Block a user