summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClementTsang <cjhtsang@uwaterloo.ca>2020-02-16 21:54:18 -0500
committerClementTsang <cjhtsang@uwaterloo.ca>2020-02-16 21:54:29 -0500
commit9fcbff99a32d0d12b9f017564bc1149cfee24432 (patch)
tree1cd0ec2bb1b4708163aa44df5261188dcaec91b8
parentf7ab907b74c4d51c8ab25cdb4cf37792a3c08727 (diff)
Update GIF, add DELETE key to search options.
-rw-r--r--README.md2
-rw-r--r--assets/cpu_filter.pngbin0 -> 103215 bytes
-rw-r--r--assets/recording_1.gifbin686412 -> 1144888 bytes
-rw-r--r--src/app.rs45
-rw-r--r--src/main.rs3
5 files changed, 43 insertions, 7 deletions
diff --git a/README.md b/README.md
index bfbca25b..52334cd0 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/assets/cpu_filter.png b/assets/cpu_filter.png
new file mode 100644
index 00000000..cbfa62b1
--- /dev/null
+++ b/assets/cpu_filter.png
Binary files differ
diff --git a/assets/recording_1.gif b/assets/recording_1.gif
index 24d24c39..4f15a7a8 100644
--- a/assets/recording_1.gif
+++ b/assets/recording_1.gif
Binary files differ
diff --git a/src/app.rs b/src/app.rs
index c9b8bac3..fd010bca 100644
--- a/src/app.rs
+++ b/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
diff --git a/src/main.rs b/src/main.rs
index 5c6fd2d4..426ab268 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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 {