aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index a0c0e773..611d65fb 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -2,7 +2,7 @@ use crate::{
commands,
compositor::{Component, Context, EventResult},
key,
- keymap::{KeymapResult, KeymapResultKind, Keymaps},
+ keymap::{KeymapResult, Keymaps},
ui::{Completion, ProgressSpinners},
};
@@ -694,7 +694,7 @@ impl EditorView {
/// Handle events by looking them up in `self.keymaps`. Returns None
/// if event was handled (a command was executed or a subkeymap was
- /// activated). Only KeymapResultKind::{NotFound, Cancelled} is returned
+ /// activated). Only KeymapResult::{NotFound, Cancelled} is returned
/// otherwise.
fn handle_keymap_event(
&mut self,
@@ -704,36 +704,36 @@ impl EditorView {
) -> Option<KeymapResult> {
cxt.editor.autoinfo = None;
let key_result = self.keymaps.get(mode, event);
- cxt.editor.autoinfo = key_result.sticky.map(|node| node.infobox());
+ cxt.editor.autoinfo = self.keymaps.sticky().map(|node| node.infobox());
- match &key_result.kind {
- KeymapResultKind::Matched(command) => command.execute(cxt),
- KeymapResultKind::Pending(node) => cxt.editor.autoinfo = Some(node.infobox()),
- KeymapResultKind::MatchedSequence(commands) => {
+ match &key_result {
+ KeymapResult::Matched(command) => command.execute(cxt),
+ KeymapResult::Pending(node) => cxt.editor.autoinfo = Some(node.infobox()),
+ KeymapResult::MatchedSequence(commands) => {
for command in commands {
command.execute(cxt);
}
}
- KeymapResultKind::NotFound | KeymapResultKind::Cancelled(_) => return Some(key_result),
+ KeymapResult::NotFound | KeymapResult::Cancelled(_) => return Some(key_result),
}
None
}
fn insert_mode(&mut self, cx: &mut commands::Context, event: KeyEvent) {
if let Some(keyresult) = self.handle_keymap_event(Mode::Insert, cx, event) {
- match keyresult.kind {
- KeymapResultKind::NotFound => {
+ match keyresult {
+ KeymapResult::NotFound => {
if let Some(ch) = event.char() {
commands::insert::insert_char(cx, ch)
}
}
- KeymapResultKind::Cancelled(pending) => {
+ KeymapResult::Cancelled(pending) => {
for ev in pending {
match ev.char() {
Some(ch) => commands::insert::insert_char(cx, ch),
None => {
- if let KeymapResultKind::Matched(command) =
- self.keymaps.get(Mode::Insert, ev).kind
+ if let KeymapResult::Matched(command) =
+ self.keymaps.get(Mode::Insert, ev)
{
command.execute(cx);
}
@@ -1182,8 +1182,8 @@ impl Component for EditorView {
// how we entered insert mode is important, and we should track that so
// we can repeat the side effect.
- self.last_insert.0 = match self.keymaps.get(mode, key).kind {
- KeymapResultKind::Matched(command) => command,
+ self.last_insert.0 = match self.keymaps.get(mode, key) {
+ KeymapResult::Matched(command) => command,
// FIXME: insert mode can only be entered through single KeyCodes
_ => unimplemented!(),
};