Place `Info::from_keymap()` contents in `keymap.infobox()`:

This makes it easier later control the order in which the key events
are presented.
pull/7085/merge
gibbz00 1 year ago committed by Blaž Hrastnik
parent 19326d23d1
commit 3d0bc72099

@ -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)
}
}

@ -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()

Loading…
Cancel
Save