mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Place Info::from_keymap()
contents in keymap.infobox()
:
This makes it easier later control the order in which the key events are presented.
This commit is contained in:
parent
19326d23d1
commit
3d0bc72099
@ -102,7 +102,15 @@ pub fn infobox(&self) -> Info {
|
||||
.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 @@ pub fn new<T, U>(title: &str, body: &[(T, U)]) -> Self
|
||||
}
|
||||
}
|
||||
|
||||
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…
Reference in New Issue
Block a user