pub struct DiffView { /* private fields */ }Expand description
A diff viewer widget that displays text differences.
Supports unified and side-by-side display modes with color-coded added, removed, and unchanged lines.
Implementations§
Source§impl DiffView
impl DiffView
Sourcepub fn new(old_text: &str, new_text: &str) -> Self
pub fn new(old_text: &str, new_text: &str) -> Self
Create a new diff view comparing old and new text.
Sourcepub fn with_unchanged_style(self, style: Style) -> Self
pub fn with_unchanged_style(self, style: Style) -> Self
Set the style for unchanged lines.
Sourcepub fn with_added_style(self, style: Style) -> Self
pub fn with_added_style(self, style: Style) -> Self
Set the style for added lines.
Sourcepub fn with_removed_style(self, style: Style) -> Self
pub fn with_removed_style(self, style: Style) -> Self
Set the style for removed lines.
Sourcepub fn with_border(self, border: BorderStyle) -> Self
pub fn with_border(self, border: BorderStyle) -> Self
Set the border style.
Sourcepub fn set_texts(&mut self, old_text: &str, new_text: &str)
pub fn set_texts(&mut self, old_text: &str, new_text: &str)
Set new texts and recompute the diff.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get the total number of display lines for the current mode.
Sourcepub fn scroll_offset(&self) -> usize
pub fn scroll_offset(&self) -> usize
Get the scroll offset.
Trait Implementations§
Source§impl InteractiveWidget for DiffView
impl InteractiveWidget for DiffView
Source§fn handle_event(&mut self, event: &Event) -> EventResult
fn handle_event(&mut self, event: &Event) -> EventResult
Handle an input event. Returns whether the event was consumed.
Auto Trait Implementations§
impl Freeze for DiffView
impl RefUnwindSafe for DiffView
impl Send for DiffView
impl Sync for DiffView
impl Unpin for DiffView
impl UnwindSafe for DiffView
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