aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNehliin2021-10-16 13:22:28 +0000
committerBlaž Hrastnik2021-10-28 01:22:52 +0000
commitfbba47fbc09d26cc41db87c5477dd7d27e8f6787 (patch)
treeb05409052858ed27a8a0152a07dd3be1612b6919
parent5501669f8c77a1b919d8d243795b280eeab3a11b (diff)
Fix panic when using multi-level key mapping
-rw-r--r--helix-term/src/keymap.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 495fe892..c7b8e895 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -140,7 +140,7 @@ impl KeyTrieNode {
}
}
body.sort_unstable_by_key(|(_, keys)| {
- self.order.iter().position(|&k| k == keys[0]).unwrap()
+ self.order.iter().position(|&k| k == keys[0]).unwrap_or(0)
});
let prefix = format!("{} ", self.name());
if body.iter().all(|(desc, _)| desc.starts_with(&prefix)) {