DiffNavigator

Struct DiffNavigator 

Source
pub struct DiffNavigator { /* private fields */ }
Expand description

Navigator for stepping through diff changes

Implementations§

Source§

impl DiffNavigator

Source

pub fn new(diff: DiffResult, old_content: String, new_content: String) -> Self

Source

pub fn state(&self) -> &StepState

Get the current step state

Source

pub fn set_state(&mut self, state: StepState) -> bool

Replace the current step state (used to restore stepping mode)

Source

pub fn diff(&self) -> &DiffResult

Get the diff result

Source

pub fn set_cursor_hunk(&mut self, hunk_idx: usize, change_id: Option<usize>)

Set a non-animated cursor for classic (no-step) navigation.

Source

pub fn clear_cursor_change(&mut self)

Clear the non-animated cursor.

Source

pub fn set_hunk_scope(&mut self, enabled: bool)

Control hunk scope markers (extent indicators).

Source

pub fn next(&mut self) -> bool

Move to the next step

Source

pub fn prev(&mut self) -> bool

Move to the previous step

Source

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)

Source

pub fn goto(&mut self, step: usize)

Jump to a specific step

Source

pub fn goto_start(&mut self)

Go to the start

Source

pub fn goto_end(&mut self)

Go to the end

Source

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

Source

pub fn prev_hunk(&mut self) -> bool

Move to the previous hunk, unapplying changes Returns true if moved, false if nothing to unapply

Source

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.

Source

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

Source

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

Source

pub fn update_current_hunk(&mut self)

Update current hunk based on applied changes

Source

pub fn current_hunk(&self) -> Option<&Hunk>

Get the current hunk

Source

pub fn hunks(&self) -> &[Hunk]

Get all hunks

Source

pub fn set_show_hunk_extent_while_stepping(&mut self, enabled: bool)

Source

pub fn active_change(&self) -> Option<&Change>

Get the currently active change

Source

pub fn changes_with_status(&self) -> Vec<(&Change, bool, bool)>

Get all changes with their application status

Source

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)

Source

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

Source

pub fn old_content(&self) -> &str

Get old content

Source

pub fn new_content(&self) -> &str

Get new content

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.