on master help sign in
Use key-sequence format for command palette keybinds (#4712)
6eec14eMichael Davis
helix-term/src/commands.rs+5−7
@@ -54,7 +54,7 @@ use crate::{
54
54
55use crate::job::{self, Jobs};
55use crate::job::{self, Jobs};
56use futures_util::StreamExt;
56use futures_util::StreamExt;
57−use std::{collections::HashMap, fmt, fmt::Write, future::Future};
57+use std::{collections::HashMap, fmt, future::Future};
58use std::{collections::HashSet, num::NonZeroUsize};
58use std::{collections::HashSet, num::NonZeroUsize};
59
59
60use std::{
60use std::{
@@ -2447,13 +2447,11 @@ impl ui::menu::Item for MappableCommand {
2447 let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
2447 let fmt_binding = |bindings: &Vec<Vec<KeyEvent>>| -> String {
2448 bindings.iter().fold(String::new(), |mut acc, bind| {
2448 bindings.iter().fold(String::new(), |mut acc, bind| {
2449 if !acc.is_empty() {
2449 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());
2451 }
2454 }
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− });
2457 acc
2455 acc
2458 })
2456 })
2459 };
2457 };