mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
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.
This commit is contained in:
parent
4b89177e53
commit
6eec14ee37
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
use crate::job::{self, Jobs};
|
use crate::job::{self, Jobs};
|
||||||
use futures_util::StreamExt;
|
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::{collections::HashSet, num::NonZeroUsize};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
@ -2447,13 +2447,11 @@ fn label(&self, keymap: &Self::Data) -> Spans {
|
|||||||
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
|
let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
|
||||||
bindings.iter().fold(String::new(), |mut acc, bind| {
|
bindings.iter().fold(String::new(), |mut acc, bind| {
|
||||||
if !acc.is_empty() {
|
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
|
acc
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user