1use crate::input::KeyEvent;
2use helix_core::unicode::width::UnicodeWidthStr;
6/// Info box used in editor. Rendering logic will be in other crate.
8 /// Title shown at top.
10 /// Text body, should contain newlines.
19 pub fn new(title: &str, body: Vec<(&str, Vec<KeyEvent>)>) -> Info {
22 .map(|(desc, events)| {
23 let events = events.iter().map(ToString::to_string).collect::<Vec<_>>();
24 (desc, events.join(", "))
28 let keymaps_width = body.iter().map(|r| r.1.len()).max().unwrap();
29 let mut text = String::new();
31 for (desc, keyevents) in &body {
42 title: title.to_string(),
43 width: text.lines().map(|l| l.width()).max().unwrap() as u16,
44 height: body.len() as u16,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list