summaryrefslogtreecommitdiff
path: root/helix-view/src/info.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/info.rs')
-rw-r--r--helix-view/src/info.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-view/src/info.rs b/helix-view/src/info.rs
index 0eaab783..92c10351 100644
--- a/helix-view/src/info.rs
+++ b/helix-view/src/info.rs
@@ -16,7 +16,7 @@ pub struct Info {
}
impl Info {
- pub fn key(title: &'static str, body: Vec<(Vec<KeyEvent>, &'static str)>) -> Info {
+ pub fn key(title: &'static str, body: Vec<(&[KeyEvent], &'static str)>) -> Info {
let keymaps_width: u16 = body
.iter()
.map(|r| r.0.iter().map(|e| e.width() as u16 + 2).sum::<u16>() - 2)
@@ -25,11 +25,11 @@ impl Info {
let mut text = String::new();
let mut width = 0;
let height = body.len() as u16;
- for (mut keyevents, desc) in body {
- let keyevent = keyevents.remove(0);
+ for (keyevents, desc) in body {
+ let keyevent = keyevents[0];
let mut left = keymaps_width - keyevent.width() as u16;
write!(text, "{}", keyevent).ok();
- for keyevent in keyevents {
+ for keyevent in &keyevents[1..] {
write!(text, ", {}", keyevent).ok();
left -= 2 + keyevent.width() as u16;
}