Skip to content

Commit c6aab7d

Browse files
the-mikedavisShekhinah Memmel
authored and
Shekhinah Memmel
committed
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 818c872 commit c6aab7d

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::{
@@ -2487,13 +2487,11 @@ impl ui::menu::Item for MappableCommand {
24872487
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
24882488
bindings.iter().fold(String::new(), |mut acc, bind| {
24892489
if !acc.is_empty() {
2490-
acc.push_str(", ");
2490+
acc.push(' ');
2491+
}
2492+
for key in bind {
2493+
acc.push_str(&key.key_sequence_format());
24912494
}
2492-
bind.iter().fold(false, |needs_plus, key| {
2493-
write!(&mut acc, "{}{}", if needs_plus { "+" } else { "" }, key)
2494-
.expect("Writing to a string can only fail on an Out-Of-Memory error");
2495-
true
2496-
});
24972495
acc
24982496
})
24992497
};

0 commit comments

Comments
 (0)