pub struct DiffViewerState {
pub diff: DiffData,
pub view_mode: DiffViewMode,
pub scroll_y: usize,
pub scroll_x: usize,
pub visible_height: usize,
pub visible_width: usize,
pub selected_hunk: Option<usize>,
pub show_line_numbers: bool,
pub search: SearchState,
}Expand description
State for the diff viewer widget
Fields§
§diff: DiffDataThe diff data to display
view_mode: DiffViewModeCurrent view mode
scroll_y: usizeVertical scroll position
scroll_x: usizeHorizontal scroll position
visible_height: usizeVisible viewport height (set during render)
visible_width: usizeVisible viewport width (set during render)
selected_hunk: Option<usize>Currently selected hunk index (for navigation)
show_line_numbers: boolWhether to show line numbers
search: SearchStateSearch state
Implementations§
Source§impl DiffViewerState
impl DiffViewerState
Sourcepub fn from_unified_diff(text: &str) -> Self
pub fn from_unified_diff(text: &str) -> Self
Create a state from unified diff text
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll down by one line
Sourcepub fn scroll_left(&mut self)
pub fn scroll_left(&mut self)
Scroll left
Sourcepub fn scroll_right(&mut self)
pub fn scroll_right(&mut self)
Scroll right
Sourcepub fn go_to_bottom(&mut self)
pub fn go_to_bottom(&mut self)
Go to bottom
Sourcepub fn go_to_line(&mut self, line: usize)
pub fn go_to_line(&mut self, line: usize)
Go to a specific line (0-indexed)
Sourcepub fn jump_to_hunk(&mut self, index: usize)
pub fn jump_to_hunk(&mut self, index: usize)
Jump to a specific hunk by index
Sourcepub fn next_change(&mut self)
pub fn next_change(&mut self)
Navigate to next change (addition or deletion)
Sourcepub fn prev_change(&mut self)
pub fn prev_change(&mut self)
Navigate to previous change (addition or deletion)
Sourcepub fn toggle_view_mode(&mut self)
pub fn toggle_view_mode(&mut self)
Toggle between side-by-side and unified view modes
Sourcepub fn set_view_mode(&mut self, mode: DiffViewMode)
pub fn set_view_mode(&mut self, mode: DiffViewMode)
Set the view mode
Sourcepub fn start_search(&mut self)
pub fn start_search(&mut self)
Start search mode
Sourcepub fn cancel_search(&mut self)
pub fn cancel_search(&mut self)
Cancel search mode
Sourcepub fn update_search(&mut self)
pub fn update_search(&mut self)
Update search with current query
Sourcepub fn next_match(&mut self)
pub fn next_match(&mut self)
Go to next search match
Sourcepub fn prev_match(&mut self)
pub fn prev_match(&mut self)
Go to previous search match
Trait Implementations§
Source§impl Clone for DiffViewerState
impl Clone for DiffViewerState
Source§fn clone(&self) -> DiffViewerState
fn clone(&self) -> DiffViewerState
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 moreAuto Trait Implementations§
impl Freeze for DiffViewerState
impl RefUnwindSafe for DiffViewerState
impl Send for DiffViewerState
impl Sync for DiffViewerState
impl Unpin for DiffViewerState
impl UnwindSafe for DiffViewerState
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> 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