utilities: respect theme_default in shortcut dialog
parent
e01275cd93
commit
007e6320d5
|
@ -733,6 +733,7 @@ pub struct Tabbed {
|
||||||
help_content: CellBuffer,
|
help_content: CellBuffer,
|
||||||
help_curr_views: ShortcutMaps,
|
help_curr_views: ShortcutMaps,
|
||||||
help_search: Option<SearchPattern>,
|
help_search: Option<SearchPattern>,
|
||||||
|
theme_default: ThemeAttribute,
|
||||||
|
|
||||||
dirty: bool,
|
dirty: bool,
|
||||||
id: ComponentId,
|
id: ComponentId,
|
||||||
|
@ -749,6 +750,7 @@ impl Tabbed {
|
||||||
help_content: CellBuffer::default(),
|
help_content: CellBuffer::default(),
|
||||||
help_screen_cursor: (0, 0),
|
help_screen_cursor: (0, 0),
|
||||||
help_search: None,
|
help_search: None,
|
||||||
|
theme_default: crate::conf::value(context, "theme_default"),
|
||||||
pinned,
|
pinned,
|
||||||
children,
|
children,
|
||||||
cursor_pos: 0,
|
cursor_pos: 0,
|
||||||
|
@ -951,8 +953,13 @@ impl Component for Tabbed {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
let mut empty_cell = Cell::default();
|
||||||
|
empty_cell
|
||||||
|
.set_fg(self.theme_default.fg)
|
||||||
|
.set_bg(self.theme_default.bg)
|
||||||
|
.set_attrs(self.theme_default.attrs);
|
||||||
self.help_content =
|
self.help_content =
|
||||||
CellBuffer::new_with_context(max_width, max_length + 2, Cell::default(), context);
|
CellBuffer::new_with_context(max_width, max_length + 2, empty_cell, context);
|
||||||
self.help_content.set_growable(true);
|
self.help_content.set_growable(true);
|
||||||
let (width, height) = self.help_content.size();
|
let (width, height) = self.help_content.size();
|
||||||
let (cols, rows) = (width!(area), height!(area));
|
let (cols, rows) = (width!(area), height!(area));
|
||||||
|
@ -968,27 +975,27 @@ impl Component for Tabbed {
|
||||||
let (x, y) = write_string_to_grid(
|
let (x, y) = write_string_to_grid(
|
||||||
"shortcut maps",
|
"shortcut maps",
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::BOLD,
|
self.theme_default.attrs,
|
||||||
((2, 0), (max_width.saturating_sub(2), max_length - 1)),
|
((2, 0), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
"Press ? to close",
|
"Press ? to close",
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::DEFAULT,
|
self.theme_default.attrs,
|
||||||
((x + 1, y), (max_width.saturating_sub(2), max_length - 1)),
|
((x + 1, y), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
"use COMMAND \"search\" to find shortcuts",
|
"use COMMAND \"search\" to find shortcuts",
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::DEFAULT,
|
self.theme_default.attrs,
|
||||||
((2, 1), (max_width.saturating_sub(2), max_length - 1)),
|
((2, 1), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -997,9 +1004,9 @@ impl Component for Tabbed {
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
"Use Up, Down, Left, Right to scroll.",
|
"Use Up, Down, Left, Right to scroll.",
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::DEFAULT,
|
self.theme_default.attrs,
|
||||||
((2, 2), (max_width.saturating_sub(2), max_length - 1)),
|
((2, 2), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -1009,9 +1016,9 @@ impl Component for Tabbed {
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
desc,
|
desc,
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::DEFAULT,
|
self.theme_default.attrs,
|
||||||
((2, 2 + idx), (max_width.saturating_sub(2), max_length - 1)),
|
((2, 2 + idx), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -1021,18 +1028,18 @@ impl Component for Tabbed {
|
||||||
let (x, y) = write_string_to_grid(
|
let (x, y) = write_string_to_grid(
|
||||||
&format!("{:1$}", v, max_width),
|
&format!("{:1$}", v, max_width),
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::BOLD,
|
self.theme_default.attrs | Attr::BOLD,
|
||||||
((2, 2 + idx), (max_width.saturating_sub(2), max_length - 1)),
|
((2, 2 + idx), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
&k,
|
&k,
|
||||||
&mut self.help_content,
|
&mut self.help_content,
|
||||||
Color::Default,
|
self.theme_default.fg,
|
||||||
Color::Default,
|
self.theme_default.bg,
|
||||||
Attr::DEFAULT,
|
self.theme_default.attrs,
|
||||||
((x + 2, y), (max_width.saturating_sub(2), max_length - 1)),
|
((x + 2, y), (max_width.saturating_sub(2), max_length - 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue