aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorCossonLeo2021-10-24 13:47:10 +0000
committerGitHub2021-10-24 13:47:10 +0000
commit2ed01f2d9c8c98a7e59fef1bb19af56ec897084b (patch)
tree24745466e00640e7f3ecf2eddba6cac2fee39c97 /helix-view/src
parentcee7ad781e5f6de249d728425a6283a26bb62dc3 (diff)
find motion and textobj motion repeat (#891)
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 51fe8a42..09fc3334 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -93,6 +93,18 @@ impl Default for Config {
}
}
+pub struct Motion(pub Box<dyn Fn(&mut Editor)>);
+impl Motion {
+ pub fn run(&self, e: &mut Editor) {
+ (self.0)(e)
+ }
+}
+impl std::fmt::Debug for Motion {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.write_str("motion")
+ }
+}
+
#[derive(Debug)]
pub struct Editor {
pub tree: Tree,
@@ -112,6 +124,7 @@ pub struct Editor {
pub config: Config,
pub idle_timer: Pin<Box<Sleep>>,
+ pub last_motion: Option<Motion>,
}
#[derive(Debug, Copy, Clone)]
@@ -147,6 +160,7 @@ impl Editor {
clipboard_provider: get_clipboard_provider(),
status_msg: None,
idle_timer: Box::pin(sleep(config.idle_timeout)),
+ last_motion: None,
config,
}
}