pub struct App {Show 15 fields
pub view: ViewState,
pub repo_path: PathBuf,
pub comparison: ComparisonContext,
pub base_identifier: String,
pub files: Vec<FileDiff>,
pub lines: Vec<DiffLine>,
pub error: Option<String>,
pub conflict_warning: Option<String>,
pub performance_warning: Option<String>,
pub gitignore_filter: GitignoreFilter,
pub file_links: HashMap<String, String>,
pub image_cache: ImageCache,
pub image_picker: Option<Picker>,
pub font_size: (u16, u16),
pub search: Option<SearchState>,
}Expand description
Application state
Fields§
§view: ViewStateView-related state (scrolling, layout, selection, etc.)
repo_path: PathBufPath to the repository root
comparison: ComparisonContextWhat we’re comparing (branch names/labels)
base_identifier: StringResolved base reference for diff computation (merge-base SHA, change ID)
files: Vec<FileDiff>All file diffs
lines: Vec<DiffLine>Flattened lines for display
error: Option<String>Error message to display (if any)
conflict_warning: Option<String>Warning message about merge conflicts (if any)
performance_warning: Option<String>Performance warning (large repo or diff)
gitignore_filter: GitignoreFilterGitignore filter for file change events
file_links: HashMap<String, String>Bidirectional map: path → related path (app ↔ spec file links)
image_cache: ImageCacheCache of loaded images for image diff display
image_picker: Option<Picker>Image protocol picker for terminal image rendering (None if terminal doesn’t support)
font_size: (u16, u16)Font size in pixels (width, height) from the Picker, used for image height calculations. Defaults to (8, 16) but updated when set_image_picker() is called.
search: Option<SearchState>Active search state (None when not searching)
Implementations§
Source§impl App
impl App
pub fn scroll_up(&mut self, n: usize)
pub fn scroll_down(&mut self, n: usize)
pub fn next_file(&mut self)
Sourcepub fn next_file_with_frame(&mut self, ctx: &FrameContext)
pub fn next_file_with_frame(&mut self, ctx: &FrameContext)
Navigate to next file using pre-computed FrameContext
pub fn prev_file(&mut self)
Sourcepub fn prev_file_with_frame(&mut self, ctx: &FrameContext)
pub fn prev_file_with_frame(&mut self, ctx: &FrameContext)
Navigate to previous file using pre-computed FrameContext
pub fn page_up(&mut self)
pub fn page_down(&mut self)
pub fn go_to_top(&mut self)
pub fn go_to_bottom(&mut self)
Sourcepub fn go_to_bottom_with_frame(&mut self, ctx: &FrameContext)
pub fn go_to_bottom_with_frame(&mut self, ctx: &FrameContext)
Go to bottom using pre-computed FrameContext
Sourcepub fn set_viewport_height(&mut self, height: usize)
pub fn set_viewport_height(&mut self, height: usize)
Set viewport height (called during rendering)
Sourcepub fn clamp_scroll_with_frame(&mut self, ctx: &FrameContext)
pub fn clamp_scroll_with_frame(&mut self, ctx: &FrameContext)
Clamp scroll offset using pre-computed FrameContext
Sourcepub fn scroll_down_with_frame(&mut self, n: usize, ctx: &FrameContext)
pub fn scroll_down_with_frame(&mut self, n: usize, ctx: &FrameContext)
Scroll down using pre-computed FrameContext
pub fn scroll_percentage(&self) -> u16
Sourcepub fn scroll_percentage_with_frame(&self, ctx: &FrameContext) -> u16
pub fn scroll_percentage_with_frame(&self, ctx: &FrameContext) -> u16
Compute scroll percentage using pre-computed FrameContext
Source§impl App
impl App
Sourcepub fn set_row_map(&mut self, row_map: Vec<ScreenRowInfo>)
pub fn set_row_map(&mut self, row_map: Vec<ScreenRowInfo>)
Set the row map (called during rendering)
Sourcepub fn start_selection(&mut self, screen_x: u16, screen_y: u16)
pub fn start_selection(&mut self, screen_x: u16, screen_y: u16)
Start a selection at the given screen coordinates
Sourcepub fn update_selection(&mut self, screen_x: u16, screen_y: u16)
pub fn update_selection(&mut self, screen_x: u16, screen_y: u16)
Update selection end point during drag
Sourcepub fn end_selection(&mut self)
pub fn end_selection(&mut self)
End selection (mouse released)
Sourcepub fn select_word_at(&mut self, screen_x: u16, screen_y: u16)
pub fn select_word_at(&mut self, screen_x: u16, screen_y: u16)
Select the word at the given screen coordinates (for double-click) If clicking past end of line, selects the entire logical line (including wrapped segments)
Sourcepub fn select_line_at(&mut self, screen_x: u16, screen_y: u16)
pub fn select_line_at(&mut self, screen_x: u16, screen_y: u16)
Select the entire logical line at the given screen position (for triple-click)
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear current selection
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if there’s an active selection
Sourcepub fn get_selected_text(&self) -> Option<String>
pub fn get_selected_text(&self) -> Option<String>
Get selected text (content only, without line numbers or prefixes) Now uses row_map to correctly handle wrapped lines and split inline diffs
Sourcepub fn copy_selection(&mut self) -> Result<bool>
pub fn copy_selection(&mut self) -> Result<bool>
Copy selected text to clipboard
Sourcepub fn copy_current_path(&mut self) -> Result<bool>
pub fn copy_current_path(&mut self) -> Result<bool>
Copy current file path to clipboard
Sourcepub fn copy_diff(&mut self) -> Result<bool>
pub fn copy_diff(&mut self) -> Result<bool>
Copy entire diff to clipboard (respects view mode and collapsed files)
Sourcepub fn copy_patch(&mut self) -> Result<bool>
pub fn copy_patch(&mut self) -> Result<bool>
Copy git patch format to clipboard (for use with git apply)
Sourcepub fn should_show_copied_flash(&self) -> bool
pub fn should_show_copied_flash(&self) -> bool
Check if the “copied” flash should be shown (within 800ms of copy)
Source§impl App
impl App
pub fn changed_line_count(&self) -> usize
pub fn additions_count(&self) -> usize
pub fn deletions_count(&self) -> usize
Sourcepub fn build_context_lines_with_mapping(
&self,
) -> (Vec<DiffLine>, Vec<Option<usize>>)
pub fn build_context_lines_with_mapping( &self, ) -> (Vec<DiffLine>, Vec<Option<usize>>)
Build filtered lines with elided markers for context mode
Sourcepub fn compute_displayable_items(&self) -> Vec<DisplayableItem>
pub fn compute_displayable_items(&self) -> Vec<DisplayableItem>
Compute displayable items as indices (more efficient than cloning lines)
pub fn cycle_view_mode(&mut self)
pub fn find_position_for_original_index(&self, original_idx: usize) -> usize
Source§impl App
impl App
Sourcepub fn new_for_bench(lines: Vec<DiffLine>) -> Self
pub fn new_for_bench(lines: Vec<DiffLine>) -> Self
Create an App instance for benchmarking with pre-built lines
Sourcepub fn new(
repo_path: PathBuf,
comparison: ComparisonContext,
initial: RefreshResult,
) -> Self
pub fn new( repo_path: PathBuf, comparison: ComparisonContext, initial: RefreshResult, ) -> Self
Create a new App instance with pre-computed comparison context and initial refresh.
The caller is responsible for detecting the VCS, building the context,
and computing the initial refresh via vcs.refresh().
Sourcepub fn set_image_picker(&mut self, picker: Picker)
pub fn set_image_picker(&mut self, picker: Picker)
Set the image picker for terminal image rendering. Also stores the font size from the picker for height calculations.
Sourcepub fn toggle_file_collapsed(&mut self, path: &str)
pub fn toggle_file_collapsed(&mut self, path: &str)
Toggle the collapse state of a file
Sourcepub fn is_file_collapsed(&self, path: &str) -> bool
pub fn is_file_collapsed(&self, path: &str) -> bool
Check if a file is collapsed
pub fn apply_refresh_result(&mut self, result: RefreshResult)
Sourcepub fn load_images_for_markers(&mut self, vcs: &dyn Vcs)
pub fn load_images_for_markers(&mut self, vcs: &dyn Vcs)
Load images for any image marker lines into the cache.
Sourcepub fn ensure_inline_spans_for_visible(
&mut self,
visible_height: usize,
) -> Vec<DisplayableItem>
pub fn ensure_inline_spans_for_visible( &mut self, visible_height: usize, ) -> Vec<DisplayableItem>
Compute inline spans for visible lines and return the displayable items. Returns the items so they can be reused by FrameContext (avoiding double computation).
pub fn update_single_file( &mut self, file_path: &str, new_diff: Option<FileDiff>, )
pub fn toggle_help(&mut self)
pub fn should_quit(&mut self) -> bool
pub fn is_search_input_active(&self) -> bool
pub fn open_search(&mut self)
pub fn close_search(&mut self)
pub fn search_insert_char(&mut self, c: char)
pub fn search_delete_char(&mut self)
pub fn search_next(&mut self)
pub fn search_prev(&mut self)
Sourcepub fn current_file(&self) -> Option<String>
pub fn current_file(&self) -> Option<String>
Get the file path of the first visible line
Sourcepub fn set_content_layout(
&mut self,
offset_x: u16,
offset_y: u16,
line_num_width: usize,
content_width: usize,
panel_width: u16,
)
pub fn set_content_layout( &mut self, offset_x: u16, offset_y: u16, line_num_width: usize, content_width: usize, panel_width: u16, )
Set content area layout info (called during rendering)
Sourcepub fn needs_inline_spans(&self) -> bool
pub fn needs_inline_spans(&self) -> bool
Check if inline spans need recomputation
Sourcepub fn clear_needs_inline_spans(&mut self)
pub fn clear_needs_inline_spans(&mut self)
Clear the needs_inline_spans flag after computation
Get the related file (app ↔ spec) for a given path.
Check if a file has a related file in the diff.
Sourcepub fn estimate_content_width(&mut self, terminal_width: u16)
pub fn estimate_content_width(&mut self, terminal_width: u16)
Estimate content_width from terminal dimensions.
This should be called BEFORE creating a FrameContext to ensure visible_range calculations use an accurate content_width for line wrapping estimates. The actual content_width is refined during rendering, but this estimate prevents the initial render from showing too few lines.
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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>
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>
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more