1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 12:23:46 +03:00

palette: adjust group prefix when menubar is empty

Avoid printing `: ` at the start of the line

refs: https://github.com/wez/wezterm/issues/1485
This commit is contained in:
Wez Furlong 2022-12-24 08:17:24 -07:00
parent b1c3103a08
commit b52ccfe36a
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -215,7 +215,11 @@ impl CommandPalette {
.skip(top_row)
.take(max_rows_on_screen)
{
let group = command.menubar.join(" | ");
let group = if command.menubar.is_empty() {
String::new()
} else {
format!("{}: ", command.menubar.join(" | "))
};
let (bg, text) = if display_idx == selected_row {
(
@ -245,9 +249,9 @@ impl CommandPalette {
let label = if command.doc.is_empty()
|| command.brief.to_ascii_lowercase() == command.doc.to_ascii_lowercase()
{
format!("{group}: {}", command.brief)
format!("{group}{}", command.brief)
} else {
format!("{group}: {}. {}", command.brief, command.doc)
format!("{group}{}. {}", command.brief, command.doc)
};
elements.push(