Skip to content

Commit b2bf67c

Browse files
the-mikedavisFrederik Vestre
authored andcommitted
Use key-sequence format for command palette keybinds (helix-editor#4712)
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 ff115cb commit b2bf67c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

helix-term/src/commands.rs

Lines changed: 5 additions & 7 deletions
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::{
@@ -2447,13 +2447,11 @@ impl ui::menu::Item for MappableCommand {
24472447
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
24482448
bindings.iter().fold(String::new(), |mut acc, bind| {
24492449
if !acc.is_empty() {
2450-
acc.push_str(", ");
2450+
acc.push(' ');
2451+
}
2452+
for key in bind {
2453+
acc.push_str(&key.key_sequence_format());
24512454
}
2452-
bind.iter().fold(false, |needs_plus, key| {
2453-
write!(&mut acc, "{}{}", if needs_plus { "+" } else { "" }, key)
2454-
.expect("Writing to a string can only fail on an Out-Of-Memory error");
2455-
true
2456-
});
24572455
acc
24582456
})
24592457
};

0 commit comments

Comments
 (0)