summaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 113102b6..af00864a 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -995,6 +995,13 @@ pub enum Action {
VerticalSplit,
}
+impl Action {
+ /// Whether to align the view to the cursor after executing this action
+ pub fn align_view(&self, view: &View, new_doc: DocumentId) -> bool {
+ !matches!((self, view.doc == new_doc), (Action::Load, false))
+ }
+}
+
/// Error thrown on failed document closed
pub enum CloseError {
/// Document doesn't exist