diff options
-rw-r--r-- | helix-term/src/keymap.rs | 10 | ||||
-rw-r--r-- | helix-view/src/info.rs | 15 |
2 files changed, 10 insertions, 15 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index b9e0ec1d..973786d5 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -102,7 +102,15 @@ impl KeyTrieNode { .position(|&k| k == *keys.iter().next().unwrap()) .unwrap() }); - Info::from_keymap(self.name(), body) + + let body: Vec<_> = body + .into_iter() + .map(|(events, desc)| { + let events = events.iter().map(ToString::to_string).collect::<Vec<_>>(); + (events.join(", "), desc) + }) + .collect(); + Info::new(self.name(), &body) } } diff --git a/helix-view/src/info.rs b/helix-view/src/info.rs index eced78e1..1503e855 100644 --- a/helix-view/src/info.rs +++ b/helix-view/src/info.rs @@ -1,6 +1,5 @@ -use crate::input::KeyEvent; use helix_core::{register::Registers, unicode::width::UnicodeWidthStr}; -use std::{collections::BTreeSet, fmt::Write}; +use std::fmt::Write; #[derive(Debug)] /// Info box used in editor. Rendering logic will be in other crate. @@ -55,18 +54,6 @@ impl Info { } } - pub fn from_keymap(title: &str, body: Vec<(BTreeSet<KeyEvent>, &str)>) -> Self { - let body: Vec<_> = body - .into_iter() - .map(|(events, desc)| { - let events = events.iter().map(ToString::to_string).collect::<Vec<_>>(); - (events.join(", "), desc) - }) - .collect(); - - Self::new(title, &body) - } - pub fn from_registers(registers: &Registers) -> Self { let body: Vec<_> = registers .inner() |