diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-25 10:35:41 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-25 10:37:19 +0300 |
commit | 22dbc7dd9f93ca8d8c7dd83f07e3986cd51d93dc (patch) | |
tree | 3fe41d2c7b4255be50b35b39f4d36936588ec5c9 /ui | |
parent | f33594fba86d18cefa81bb7d64cc7b7357a9e8c6 (diff) |
ui: don't print empty history or duplicates
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/components/utilities.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs index 59b4c797..72cbed84 100644 --- a/ui/src/components/utilities.rs +++ b/ui/src/components/utilities.rs @@ -789,12 +789,14 @@ impl Component for StatusBar { self.auto_complete.cursor() }; clear_area(grid, hist_area); - change_colors( - grid, - hist_area, - Color::Byte(88), // DarkRed, - Color::Byte(174), //LightPink3 - ); + if hist_height > 0 { + change_colors( + grid, + hist_area, + Color::Byte(88), // DarkRed, + Color::Byte(174), //LightPink3 + ); + } for (y_offset, s) in self .auto_complete .suggestions() @@ -900,7 +902,11 @@ impl Component for StatusBar { .to_full_result() .is_ok() { - self.cmd_history.push(self.ex_buffer.as_str().to_string()); + if self.cmd_history.last().map(String::as_str) + != Some(self.ex_buffer.as_str()) + { + self.cmd_history.push(self.ex_buffer.as_str().to_string()); + } } self.ex_buffer.clear(); } |