Skip to content

Commit 7674dae

Browse files
wugeerextrawurst
andauthored
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>
1 parent 3e98a40 commit 7674dae

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
* resolve `core.hooksPath` relative to `GIT_WORK_TREE` [[@naseschwarz](https://github.com/naseschwarz)] ([#2571](https://github.com/gitui-org/gitui/issues/2571))
3434
* 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)
3535
* print slightly nicer errors when failing to create a directory [[@linkmauve](https://github.com/linkmauve)] (https://github.com/gitui-org/gitui/pull/2728)
36+
* 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))
3637

3738
## [0.27.0] - 2024-01-14
3839

src/cmdbar.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ enum DrawListEntry {
2020
struct Command {
2121
txt: String,
2222
enabled: bool,
23-
line: usize,
2423
}
2524

2625
/// helper to be used while drawing
@@ -106,7 +105,6 @@ impl CommandBar {
106105
self.draw_list.push(DrawListEntry::Command(Command {
107106
txt: c.text.name.clone(),
108107
enabled: c.enabled,
109-
line: lines.saturating_sub(1) as usize,
110108
}));
111109
}
112110

@@ -157,9 +155,7 @@ impl CommandBar {
157155
DrawListEntry::Command(c) => {
158156
Span::styled(
159157
Cow::from(c.txt.as_str()),
160-
self.theme.commandbar(
161-
c.enabled, c.line,
162-
),
158+
self.theme.commandbar(c.enabled),
163159
)
164160
}
165161
DrawListEntry::LineBreak => {

src/ui/style.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct Theme {
1818
selection_fg: Color,
1919
use_selection_fg: bool,
2020
cmdbar_bg: Color,
21-
cmdbar_extra_lines_bg: Color,
2221
disabled_fg: Color,
2322
diff_line_add: Color,
2423
diff_line_delete: Color,
@@ -211,17 +210,13 @@ impl Theme {
211210
self.line_break.clone()
212211
}
213212

214-
pub fn commandbar(&self, enabled: bool, line: usize) -> Style {
213+
pub fn commandbar(&self, enabled: bool) -> Style {
215214
if enabled {
216215
Style::default().fg(self.command_fg)
217216
} else {
218217
Style::default().fg(self.disabled_fg)
219218
}
220-
.bg(if line == 0 {
221-
self.cmdbar_bg
222-
} else {
223-
self.cmdbar_extra_lines_bg
224-
})
219+
.bg(self.cmdbar_bg)
225220
}
226221

227222
pub fn commit_hash(&self, selected: bool) -> Style {
@@ -347,7 +342,6 @@ impl Default for Theme {
347342
selection_fg: Color::White,
348343
use_selection_fg: true,
349344
cmdbar_bg: Color::Blue,
350-
cmdbar_extra_lines_bg: Color::Blue,
351345
disabled_fg: Color::DarkGray,
352346
diff_line_add: Color::Green,
353347
diff_line_delete: Color::Red,

0 commit comments

Comments
 (0)