Update GIF, add DELETE key to search options.
This commit is contained in:
parent
f7ab907b74
commit
9fcbff99a3
|
@ -4,7 +4,7 @@
|
|||
|
||||
A graphical top clone, written in Rust. Inspired by both [gtop](https://github.com/aksakalli/gtop) and [gotop](https://github.com/cjbassi/gotop). Supports Linux, macOS, and Windows.
|
||||
|
||||
![Quick demo recording](assets/recording_1.gif) _Terminal: Kitty Terminal, Font: IBM Plex Mono, OS: Arch Linux_
|
||||
![Quick demo recording](assets/recording_1.gif) _Terminal: Kitty Terminal, Font: IBM Plex Mono, OS: Arch Linux. Theme based on [gruvbox](https://github.com/morhetz/gruvbox) (see sample config)_
|
||||
|
||||
## Features
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 101 KiB |
Binary file not shown.
Before Width: | Height: | Size: 670 KiB After Width: | Height: | Size: 1.1 MiB |
45
src/app.rs
45
src/app.rs
|
@ -410,6 +410,40 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn on_delete(&mut self) {
|
||||
match self.current_widget_selected {
|
||||
WidgetPosition::Process => self.start_dd(),
|
||||
WidgetPosition::ProcessSearch => {
|
||||
if self.process_search_state.search_state.is_enabled
|
||||
&& self
|
||||
.process_search_state
|
||||
.search_state
|
||||
.current_cursor_position < self
|
||||
.process_search_state
|
||||
.search_state
|
||||
.current_search_query
|
||||
.len()
|
||||
{
|
||||
self.process_search_state
|
||||
.search_state
|
||||
.current_search_query
|
||||
.remove(
|
||||
self.process_search_state
|
||||
.search_state
|
||||
.current_cursor_position,
|
||||
);
|
||||
|
||||
self.update_regex();
|
||||
self.update_process_gui = true;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// Deletes an entire word till the next space or end
|
||||
pub fn on_skip_backspace(&mut self) {}
|
||||
|
||||
pub fn is_searching(&self) -> bool {
|
||||
self.process_search_state.search_state.is_enabled
|
||||
}
|
||||
|
@ -535,11 +569,12 @@ impl App {
|
|||
|
||||
pub fn on_backspace(&mut self) {
|
||||
if let WidgetPosition::ProcessSearch = self.current_widget_selected {
|
||||
if self
|
||||
.process_search_state
|
||||
.search_state
|
||||
.current_cursor_position
|
||||
> 0
|
||||
if self.process_search_state.search_state.is_enabled
|
||||
&& self
|
||||
.process_search_state
|
||||
.search_state
|
||||
.current_cursor_position
|
||||
> 0
|
||||
{
|
||||
self.process_search_state
|
||||
.search_state
|
||||
|
|
|
@ -319,7 +319,7 @@ fn handle_key_event_or_break(
|
|||
KeyCode::Enter => app.on_enter(),
|
||||
KeyCode::Tab => app.on_tab(),
|
||||
KeyCode::Backspace => app.on_backspace(),
|
||||
KeyCode::Delete => app.start_dd(),
|
||||
KeyCode::Delete => app.on_delete(),
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
|
@ -342,6 +342,7 @@ fn handle_key_event_or_break(
|
|||
}
|
||||
KeyCode::Char('a') => app.skip_cursor_beginning(),
|
||||
KeyCode::Char('e') => app.skip_cursor_end(),
|
||||
KeyCode::Backspace => app.on_skip_backspace(),
|
||||
_ => {}
|
||||
}
|
||||
} else if let KeyModifiers::SHIFT = event.modifiers {
|
||||
|
|
Loading…
Reference in New Issue