Skip to content

Commit

Permalink
ui: "unselect" the current tab when in search mode
Browse files Browse the repository at this point in the history
  • Loading branch information
adamperkowski committed Jan 14, 2025
1 parent d91a44e commit 9446d64
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,19 @@ impl AppState {
.map(|tab| tab.name.as_str())
.collect::<Vec<_>>();

let tab_hl_style = if let Focus::TabList = self.focus {
Style::default().reversed().fg(self.theme.tab_color())
} else {
Style::new().fg(self.theme.tab_color())
let (tab_hl_style, highlight_symbol) = if let Focus::TabList = self.focus {
(Style::default().reversed().fg(self.theme.tab_color()), self.theme.tab_icon())
} else if let Focus::Search = self.focus {
(Style::reset(), " ")
}
else {
(Style::new().fg(self.theme.tab_color()), self.theme.tab_icon())
};

let tab_list = List::new(tabs)
.block(Block::bordered().border_set(border::ROUNDED))
.highlight_style(tab_hl_style)
.highlight_symbol(self.theme.tab_icon());
.highlight_symbol(highlight_symbol);
frame.render_stateful_widget(tab_list, left_chunks[1], &mut self.current_tab);

let chunks =
Expand Down

0 comments on commit 9446d64

Please sign in to comment.