aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs24
1 files changed, 1 insertions, 23 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 0b624f25..3c954ee5 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -118,29 +118,7 @@ impl<'a> Context<'a> {
}
}
-pub enum Align {
- Top,
- Center,
- Bottom,
-}
-
-pub fn align_view(doc: &Document, view: &mut View, align: Align) {
- let pos = doc
- .selection(view.id)
- .primary()
- .cursor(doc.text().slice(..));
- let line = doc.text().char_to_line(pos);
-
- let height = view.inner_area().height as usize;
-
- let relative = match align {
- Align::Center => height / 2,
- Align::Top => 0,
- Align::Bottom => height,
- };
-
- view.offset.row = line.saturating_sub(relative);
-}
+use helix_view::{align_view, Align};
/// A MappableCommand is either a static command like "jump_view_up" or a Typable command like
/// :format. It causes a side-effect on the state (usually by creating and applying a transaction).