diff options
-rw-r--r-- | src/config/configuration.rs | 5 | ||||
-rw-r--r-- | src/io/display.rs | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/config/configuration.rs b/src/config/configuration.rs index 93699ff..b654036 100644 --- a/src/config/configuration.rs +++ b/src/config/configuration.rs @@ -312,6 +312,11 @@ impl MenuColors { color_to_attr(self.palette_4), ] } + + #[inline] + pub const fn palette_size(&self) -> usize { + self.palette().len() + } } lazy_static::lazy_static! { diff --git a/src/io/display.rs b/src/io/display.rs index eb8ee95..50897fd 100644 --- a/src/io/display.rs +++ b/src/io/display.rs @@ -674,7 +674,7 @@ impl<'a> Draw for WinMainFooter<'a> { _ => Footer::new(self.status, self.tab)?.elems().to_owned(), }; let mut attr = color_to_attr(MENU_COLORS.first); - let last_index = (content.len() + 3) % 4; + let last_index = (content.len().saturating_sub(1)) % MENU_COLORS.palette_size(); let mut background = MENU_COLORS.palette()[last_index]; if self.is_selected { attr.effect |= Effect::REVERSE; @@ -949,7 +949,12 @@ impl<'a> WinSecondary<'a> { } fn draw_cli_applications(&self, canvas: &mut dyn Canvas) -> Result<()> { - canvas.print_with_attr(1, 2, "pick a command", color_to_attr(MENU_COLORS.second))?; + canvas.print_with_attr( + 1, + 2, + self.tab.edit_mode.second_line(), + color_to_attr(MENU_COLORS.second), + )?; let content = &self.status.menu.cli_applications.content; let desc_size = self.status.menu.cli_applications.desc_size; |