Skip to content

Commit 9687401

Browse files
committed
fix: When the terminal is insufficient to display all the commands, the cmdbar_bg configuration color does not fully take effect
1 parent 1866bf5 commit 9687401

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
* use default shell instead of bash on Unix-like OS [[@yerke](https://github.com/yerke)] ([#2343](https://github.com/extrawurst/gitui/pull/2343))
1212

1313
### Fixes
14+
* 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))
1415
* respect env vars like `GIT_CONFIG_GLOBAL` ([#2298](https://github.com/extrawurst/gitui/issues/2298))
1516
* Set `CREATE_NO_WINDOW` flag when executing Git hooks on Windows ([#2371](https://github.com/extrawurst/gitui/pull/2371))
1617

src/cmdbar.rs

+1-5
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.to_string(),
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

+2-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub struct Theme {
1616
selection_bg: Color,
1717
selection_fg: Color,
1818
cmdbar_bg: Color,
19-
cmdbar_extra_lines_bg: Color,
2019
disabled_fg: Color,
2120
diff_line_add: Color,
2221
diff_line_delete: Color,
@@ -204,17 +203,13 @@ impl Theme {
204203
self.line_break.clone()
205204
}
206205

207-
pub fn commandbar(&self, enabled: bool, line: usize) -> Style {
206+
pub fn commandbar(&self, enabled: bool) -> Style {
208207
if enabled {
209208
Style::default().fg(self.command_fg)
210209
} else {
211210
Style::default().fg(self.disabled_fg)
212211
}
213-
.bg(if line == 0 {
214-
self.cmdbar_bg
215-
} else {
216-
self.cmdbar_extra_lines_bg
217-
})
212+
.bg(self.cmdbar_bg)
218213
}
219214

220215
pub fn commit_hash(&self, selected: bool) -> Style {
@@ -335,7 +330,6 @@ impl Default for Theme {
335330
selection_bg: Color::Blue,
336331
selection_fg: Color::White,
337332
cmdbar_bg: Color::Blue,
338-
cmdbar_extra_lines_bg: Color::Blue,
339333
disabled_fg: Color::DarkGray,
340334
diff_line_add: Color::Green,
341335
diff_line_delete: Color::Red,

0 commit comments

Comments
 (0)