aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-30 05:09:59 +0000
committerBlaž Hrastnik2020-12-03 04:11:12 +0000
commit8f0bcfe286d97dfff67bd924e11ca2b6ae1a63dc (patch)
treebece6a149e50b864b7593be1c8c66f738a5fdc97 /helix-term/src/application.rs
parentae8a9e5bac2cb4683015604bb5a431781717c991 (diff)
Introduce a command context that carries the executor and other fields.
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs29
1 files changed, 25 insertions, 4 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index a4a3cf09..cacfde56 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -476,13 +476,24 @@ impl<'a> Application<'a> {
match view.doc.mode() {
Mode::Insert => {
if let Some(command) = self.keymap[&Mode::Insert].get(&keys) {
- command(view, 1);
+ let mut cx = helix_view::commands::Context {
+ view,
+ executor: self.executor,
+ count: 1,
+ };
+
+ command(&mut cx);
} else if let KeyEvent {
code: KeyCode::Char(c),
..
} = event
{
- commands::insert::insert_char(view, c);
+ let mut cx = helix_view::commands::Context {
+ view,
+ executor: self.executor,
+ count: 1,
+ };
+ commands::insert::insert_char(&mut cx, c);
}
view.ensure_cursor_in_view();
}
@@ -544,7 +555,12 @@ impl<'a> Application<'a> {
// HAXX: special casing for command mode
} else if let Some(command) = self.keymap[&Mode::Normal].get(&keys) {
- command(view, 1);
+ let mut cx = helix_view::commands::Context {
+ view,
+ executor: self.executor,
+ count: 1,
+ };
+ command(&mut cx);
// TODO: simplistic ensure cursor in view for now
view.ensure_cursor_in_view();
@@ -552,7 +568,12 @@ impl<'a> Application<'a> {
}
mode => {
if let Some(command) = self.keymap[&mode].get(&keys) {
- command(view, 1);
+ let mut cx = helix_view::commands::Context {
+ view,
+ executor: self.executor,
+ count: 1,
+ };
+ command(&mut cx);
// TODO: simplistic ensure cursor in view for now
view.ensure_cursor_in_view();