pub enum ScrollStyle {
Direction2D(MoveDir2D, ScrollSize, Count),
CursorPos(MovePosition, Axis),
LinePos(MovePosition, Count),
}Expand description
This represents the way in which the viewport should be scrolled.
Variants§
Direction2D(MoveDir2D, ScrollSize, Count)
Scroll the viewport in MoveDir2D direction by ScrollSize units, n times.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let scroll: Action = action!("scroll -s (dir2d -d up -z half-page)");
let style = ScrollStyle::Direction2D(MoveDir2D::Up, ScrollSize::HalfPage, Count::Contextual);
assert_eq!(scroll, Action::Scroll(style));See the documentation for ScrollSize for how to construct each of its variants with action.
CursorPos(MovePosition, Axis)
Scroll the viewport so that the cursor is placed at MovePosition relative to Axis.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let scroll: Action = action!("scroll -s (cursor-pos -p end -x vertical)");
let style = ScrollStyle::CursorPos(MovePosition::End, Axis::Vertical);
assert_eq!(scroll, Action::Scroll(style));See the documentation for Axis and MovePosition for how to construct each of their variants with action.
LinePos(MovePosition, Count)
Scroll the viewport so that the nth line is at MovePosition on the screen.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let scroll: Action = action!("scroll -s (line-pos -p end -c 1)");
let style = ScrollStyle::LinePos(MovePosition::End, 1.into());
assert_eq!(scroll, Action::Scroll(style));See the documentation for MovePosition for how to construct each of its variants with action.
Trait Implementations§
Source§impl Clone for ScrollStyle
impl Clone for ScrollStyle
Source§fn clone(&self) -> ScrollStyle
fn clone(&self) -> ScrollStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScrollStyle
impl Debug for ScrollStyle
Source§impl PartialEq for ScrollStyle
impl PartialEq for ScrollStyle
impl Eq for ScrollStyle
impl StructuralPartialEq for ScrollStyle
Auto Trait Implementations§
impl Freeze for ScrollStyle
impl RefUnwindSafe for ScrollStyle
impl Send for ScrollStyle
impl Sync for ScrollStyle
impl Unpin for ScrollStyle
impl UnwindSafe for ScrollStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more