Skip to content

Commit 7fc8a03

Browse files
authored
fix(compact-bar): make tooltip hints use opaque bg (zellij-org#4356)
* fix(compact-bar): make tooltip hints use opaque bg * docs(changelog): add PR
1 parent 03f81ea commit 7fc8a03

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
99
* fix: Zellij Web login issue with safari (https://github.com/zellij-org/zellij/pull/4345)
1010
* fix: terminal title regression (https://github.com/zellij-org/zellij/pull/4352)
1111
* fix: resurrection listing regression (https://github.com/zellij-org/zellij/pull/4354)
12+
* fix: tooltip keybinding backgrounds (https://github.com/zellij-org/zellij/pull/4356)
1213

1314
## [0.43.0] - 2025-08-05
1415
* feat: multiple select and bulk pane actions (https://github.com/zellij-org/zellij/pull/4169 and https://github.com/zellij-org/zellij/pull/4171, https://github.com/zellij-org/zellij/pull/4221 and https://github.com/zellij-org/zellij/pull/4286)

default-plugins/compact-bar/src/line.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl RightSideElementsBuilder {
389389

390390
fn create_tooltip_indicator(&self, toggle_key: &str, is_active: bool) -> LinePart {
391391
let key_text = toggle_key;
392-
let key = Text::new(key_text).color_all(3);
392+
let key = Text::new(key_text).color_all(3).opaque();
393393
let ribbon_text = "Tooltip";
394394
let mut ribbon = Text::new(ribbon_text);
395395

default-plugins/compact-bar/src/tooltip.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<'a> TooltipRenderer<'a> {
2929
// if it does
3030
if base_x + x + total_element_width > cols {
3131
let remaining_space = cols.saturating_sub(base_x + x);
32-
let ellipsis = Text::new("...");
32+
let ellipsis = Text::new("...").opaque();
3333
print_text_with_coordinates(
3434
ellipsis,
3535
base_x + x,
@@ -43,7 +43,7 @@ impl<'a> TooltipRenderer<'a> {
4343
print_text_with_coordinates(text, base_x + x, base_y + y, None, None);
4444
print_ribbon_with_coordinates(
4545
ribbon,
46-
base_x + x + text_width + 1,
46+
base_x + x + text_width,
4747
base_y + y,
4848
None,
4949
None,
@@ -80,15 +80,25 @@ impl<'a> TooltipRenderer<'a> {
8080
let mut components = Vec::new();
8181
let mut max_columns = 0;
8282

83+
let mut is_first = true;
8384
for (key, description) in actions {
84-
let text = Text::new(&key).color_all(3);
85+
let text = if is_first {
86+
Text::new(format!("{} ", &key)).color_all(3).opaque()
87+
} else {
88+
Text::new(format!(" {} ", &key)).color_all(3).opaque()
89+
};
8590
let ribbon = Text::new(&description);
8691

87-
let line_length = key.chars().count() + 1 + description.chars().count();
92+
let line_length = if is_first {
93+
key.chars().count() + description.chars().count()
94+
} else {
95+
key.chars().count() + 1 + description.chars().count()
96+
};
8897

8998
components.push((text, ribbon, running_x, y));
9099
running_x += line_length + 5;
91100
max_columns = max_columns.max(running_x);
101+
is_first = false;
92102
}
93103

94104
let total_rows = 1;

0 commit comments

Comments
 (0)