fix: When the terminal is insufficient to display all the commands, the cmdbar_bg configuration color does not fully take effect (#2348)

Co-authored-by: extrawurst <776816+extrawurst@users.noreply.github.com>
This commit is contained in:
wugeer 2025-10-29 01:42:54 +08:00 committed by GitHub
parent 3e98a40206
commit 7674dae0cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 13 deletions

View file

@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* resolve `core.hooksPath` relative to `GIT_WORK_TREE` [[@naseschwarz](https://github.com/naseschwarz)] ([#2571](https://github.com/gitui-org/gitui/issues/2571))
* yanking commit ranges no longer generates incorrect dotted range notations, but lists each individual commit [[@naseschwarz](https://github.com/naseschwarz)] (https://github.com/gitui-org/gitui/issues/2576)
* print slightly nicer errors when failing to create a directory [[@linkmauve](https://github.com/linkmauve)] (https://github.com/gitui-org/gitui/pull/2728)
* When the terminal is insufficient to display all the commands, the cmdbar_bg configuration color does not fully take effect. ([#2347](https://github.com/extrawurst/gitui/issues/2347))
## [0.27.0] - 2024-01-14

View file

@ -20,7 +20,6 @@ enum DrawListEntry {
struct Command {
txt: String,
enabled: bool,
line: usize,
}
/// helper to be used while drawing
@ -106,7 +105,6 @@ impl CommandBar {
self.draw_list.push(DrawListEntry::Command(Command {
txt: c.text.name.clone(),
enabled: c.enabled,
line: lines.saturating_sub(1) as usize,
}));
}
@ -157,9 +155,7 @@ impl CommandBar {
DrawListEntry::Command(c) => {
Span::styled(
Cow::from(c.txt.as_str()),
self.theme.commandbar(
c.enabled, c.line,
),
self.theme.commandbar(c.enabled),
)
}
DrawListEntry::LineBreak => {

View file

@ -18,7 +18,6 @@ pub struct Theme {
selection_fg: Color,
use_selection_fg: bool,
cmdbar_bg: Color,
cmdbar_extra_lines_bg: Color,
disabled_fg: Color,
diff_line_add: Color,
diff_line_delete: Color,
@ -211,17 +210,13 @@ impl Theme {
self.line_break.clone()
}
pub fn commandbar(&self, enabled: bool, line: usize) -> Style {
pub fn commandbar(&self, enabled: bool) -> Style {
if enabled {
Style::default().fg(self.command_fg)
} else {
Style::default().fg(self.disabled_fg)
}
.bg(if line == 0 {
self.cmdbar_bg
} else {
self.cmdbar_extra_lines_bg
})
.bg(self.cmdbar_bg)
}
pub fn commit_hash(&self, selected: bool) -> Style {
@ -347,7 +342,6 @@ impl Default for Theme {
selection_fg: Color::White,
use_selection_fg: true,
cmdbar_bg: Color::Blue,
cmdbar_extra_lines_bg: Color::Blue,
disabled_fg: Color::DarkGray,
diff_line_add: Color::Green,
diff_line_delete: Color::Red,