Skip to content

Commit d70d3df

Browse files
committed
Use key-sequence format for command palette keybinds
The text within the command palette used a custom format to display the keybinding for a command. This change switches to the key sequence format that we use for pending keys and macros.
1 parent 5b73c8c commit d70d3df

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

helix-term/src/commands.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use crate::{
5454

5555
use crate::job::{self, Jobs};
5656
use futures_util::StreamExt;
57-
use std::{collections::HashMap, fmt, fmt::Write, future::Future};
57+
use std::{collections::HashMap, fmt, future::Future};
5858
use std::{collections::HashSet, num::NonZeroUsize};
5959

6060
use std::{
@@ -2431,13 +2431,11 @@ impl ui::menu::Item for MappableCommand {
24312431
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
24322432
bindings.iter().fold(String::new(), |mut acc, bind| {
24332433
if !acc.is_empty() {
2434-
acc.push_str(", ");
2434+
acc.push_str(" ");
2435+
}
2436+
for key in bind {
2437+
acc.push_str(&key.key_sequence_format());
24352438
}
2436-
bind.iter().fold(false, |needs_plus, key| {
2437-
write!(&mut acc, "{}{}", if needs_plus { "+" } else { "" }, key)
2438-
.expect("Writing to a string can only fail on an Out-Of-Memory error");
2439-
true
2440-
});
24412439
acc
24422440
})
24432441
};

0 commit comments

Comments
 (0)