summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorMichael Davis2022-11-17 00:58:54 +0000
committerGitHub2022-11-17 00:58:54 +0000
commit6eec14ee3726fc46850025ea1e184ecf74db5cf4 (patch)
tree8178f2a6c41ff4410ff0da42eb75946cb2b0dd96 /helix-term/src
parent4b89177e53a467ceda2e3ee95fc77874f77d2b85 (diff)
Use key-sequence format for command palette keybinds (#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.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 707cc9bd..2f2427ec 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -54,7 +54,7 @@ use crate::{
use crate::job::{self, Jobs};
use futures_util::StreamExt;
-use std::{collections::HashMap, fmt, fmt::Write, future::Future};
+use std::{collections::HashMap, fmt, future::Future};
use std::{collections::HashSet, num::NonZeroUsize};
use std::{
@@ -2447,13 +2447,11 @@ impl ui::menu::Item for MappableCommand {
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
bindings.iter().fold(String::new(), |mut acc, bind| {
if !acc.is_empty() {
- acc.push_str(", ");
+ acc.push(' ');
+ }
+ for key in bind {
+ acc.push_str(&key.key_sequence_format());
}
- bind.iter().fold(false, |needs_plus, key| {
- write!(&mut acc, "{}{}", if needs_plus { "+" } else { "" }, key)
- .expect("Writing to a string can only fail on an Out-Of-Memory error");
- true
- });
acc
})
};