aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs2
-rw-r--r--helix-view/src/info.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index b006a124..4f01cce4 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -33,7 +33,7 @@ pub struct Editor {
pub syn_loader: Arc<syntax::Loader>,
pub theme_loader: Arc<theme::Loader>,
- pub autoinfo: Option<Info>,
+ pub autoinfo: Option<&'static Info>,
pub status_msg: Option<(String, Severity)>,
}
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;
}