pub struct CodeViewState { /* private fields */ }Expand description
State for the code view widget
Implementations§
Source§impl CodeViewState
impl CodeViewState
Sourcepub fn current_file(&self) -> Option<&Path>
pub fn current_file(&self) -> Option<&Path>
Get current file path
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get line count
Sourcepub fn scroll_offset(&self) -> usize
pub fn scroll_offset(&self) -> usize
Get scroll offset
Sourcepub fn selected_line(&self) -> usize
pub fn selected_line(&self) -> usize
Get selected line (1-indexed)
Sourcepub fn set_selected_line(&mut self, line: usize)
pub fn set_selected_line(&mut self, line: usize)
Set selected line (1-indexed)
Sourcepub fn set_selection(&mut self, start: usize, end: usize)
pub fn set_selection(&mut self, start: usize, end: usize)
Set selection range (start, end) 1-indexed
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear selection
Sourcepub fn scroll_down(&mut self, amount: usize)
pub fn scroll_down(&mut self, amount: usize)
Scroll down by amount
Sourcepub fn scroll_to_line(&mut self, line: usize, visible_height: usize)
pub fn scroll_to_line(&mut self, line: usize, visible_height: usize)
Scroll to make a specific line visible (1-indexed)
Sourcepub fn goto_first(&mut self)
pub fn goto_first(&mut self)
Go to first line
Sourcepub fn select_by_row(&mut self, row: usize) -> bool
pub fn select_by_row(&mut self, row: usize) -> bool
Select a line by visible row (for mouse clicks) Returns true if selection changed
Trait Implementations§
Source§impl Clone for CodeViewState
impl Clone for CodeViewState
Source§fn clone(&self) -> CodeViewState
fn clone(&self) -> CodeViewState
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 CodeViewState
impl Debug for CodeViewState
Source§impl Default for CodeViewState
impl Default for CodeViewState
Source§fn default() -> CodeViewState
fn default() -> CodeViewState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CodeViewState
impl RefUnwindSafe for CodeViewState
impl Send for CodeViewState
impl Sync for CodeViewState
impl Unpin for CodeViewState
impl UnwindSafe for CodeViewState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more