ui: don't print empty history or duplicates

embed
Manos Pitsidianakis 2019-06-25 10:35:41 +03:00
parent f33594fba8
commit 22dbc7dd9f
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 13 additions and 7 deletions

View File

@ -789,12 +789,14 @@ impl Component for StatusBar {
self.auto_complete.cursor() self.auto_complete.cursor()
}; };
clear_area(grid, hist_area); clear_area(grid, hist_area);
if hist_height > 0 {
change_colors( change_colors(
grid, grid,
hist_area, hist_area,
Color::Byte(88), // DarkRed, Color::Byte(88), // DarkRed,
Color::Byte(174), //LightPink3 Color::Byte(174), //LightPink3
); );
}
for (y_offset, s) in self for (y_offset, s) in self
.auto_complete .auto_complete
.suggestions() .suggestions()
@ -899,9 +901,13 @@ impl Component for StatusBar {
if parse_command(&self.ex_buffer.as_str().as_bytes()) if parse_command(&self.ex_buffer.as_str().as_bytes())
.to_full_result() .to_full_result()
.is_ok() .is_ok()
{
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.cmd_history.push(self.ex_buffer.as_str().to_string());
} }
}
self.ex_buffer.clear(); self.ex_buffer.clear();
} }
UIMode::Execute => { UIMode::Execute => {