pub struct DiffNavigator { /* private fields */ }Expand description
Navigator for stepping through diff changes
Implementations§
pub fn new(diff: DiffResult, old_content: String, new_content: String) -> Self
Sourcepub fn set_state(&mut self, state: StepState) -> bool
pub fn set_state(&mut self, state: StepState) -> bool
Replace the current step state (used to restore stepping mode)
Sourcepub fn diff(&self) -> &DiffResult
pub fn diff(&self) -> &DiffResult
Get the diff result
Sourcepub fn set_cursor_hunk(&mut self, hunk_idx: usize, change_id: Option<usize>)
pub fn set_cursor_hunk(&mut self, hunk_idx: usize, change_id: Option<usize>)
Set a non-animated cursor for classic (no-step) navigation.
Sourcepub fn clear_cursor_change(&mut self)
pub fn clear_cursor_change(&mut self)
Clear the non-animated cursor.
Sourcepub fn set_hunk_scope(&mut self, enabled: bool)
pub fn set_hunk_scope(&mut self, enabled: bool)
Control hunk scope markers (extent indicators).
Sourcepub fn clear_active_change(&mut self)
pub fn clear_active_change(&mut self)
Clear animation state (called after animation completes or one-frame render) For backward steps, keeps cursor on last applied change (destination)
Sourcepub fn goto_start(&mut self)
pub fn goto_start(&mut self)
Go to the start
Sourcepub fn next_hunk(&mut self) -> bool
pub fn next_hunk(&mut self) -> bool
Move to the next hunk, applying ALL changes (full preview mode). If current hunk is not started, applies all its changes with cursor at top. If current hunk is partially/fully applied, completes it and moves to next hunk. Returns true if moved, false if no movement possible
Sourcepub fn prev_hunk(&mut self) -> bool
pub fn prev_hunk(&mut self) -> bool
Move to the previous hunk, unapplying changes Returns true if moved, false if nothing to unapply
Sourcepub fn goto_hunk(&mut self, hunk_idx: usize)
pub fn goto_hunk(&mut self, hunk_idx: usize)
Go to a specific hunk (0-indexed) Applies all changes through target hunk (full preview mode). Cursor lands at top of target hunk.
Sourcepub fn goto_hunk_start(&mut self) -> bool
pub fn goto_hunk_start(&mut self) -> bool
Jump to first change of current hunk, unapplying all but first Returns true if moved, false if not inside a hunk or already at start
Sourcepub fn goto_hunk_end(&mut self) -> bool
pub fn goto_hunk_end(&mut self) -> bool
Jump to last change of current hunk, applying all changes in hunk Returns true if moved, false if not inside a hunk or already at end
Sourcepub fn update_current_hunk(&mut self)
pub fn update_current_hunk(&mut self)
Update current hunk based on applied changes
Sourcepub fn current_hunk(&self) -> Option<&Hunk>
pub fn current_hunk(&self) -> Option<&Hunk>
Get the current hunk
pub fn set_show_hunk_extent_while_stepping(&mut self, enabled: bool)
Sourcepub fn active_change(&self) -> Option<&Change>
pub fn active_change(&self) -> Option<&Change>
Get the currently active change
Sourcepub fn changes_with_status(&self) -> Vec<(&Change, bool, bool)>
pub fn changes_with_status(&self) -> Vec<(&Change, bool, bool)>
Get all changes with their application status
Sourcepub fn current_view(&self) -> Vec<ViewLine>
pub fn current_view(&self) -> Vec<ViewLine>
Reconstruct the content at the current step Returns lines with their change status (uses Idle frame for backwards compatibility)
Sourcepub fn current_view_with_frame(&self, frame: AnimationFrame) -> Vec<ViewLine>
pub fn current_view_with_frame(&self, frame: AnimationFrame) -> Vec<ViewLine>
Phase-aware view for word-level animation CLI should pass its current animation phase for proper fade animations
Sourcepub fn old_content(&self) -> &str
pub fn old_content(&self) -> &str
Get old content
Sourcepub fn new_content(&self) -> &str
pub fn new_content(&self) -> &str
Get new content