pub struct App { /* private fields */ }Expand description
The application: owns all state and drives the event loop.
Implementations§
Source§impl App
impl App
Sourcepub fn open_export_modal(&mut self)
pub fn open_export_modal(&mut self)
Open the export options modal.
Builds one ExportJob per format — HTML first, then every custom converter
CustomExportEntry::config_problem did not flag — cloned from config now, so a later
reload can’t change what the chosen format runs.
Seeded from [export.html]: the title from the document’s first H1 (else the file stem),
and the stylesheet pill from Default plus every .css in <config_dir>/export/. Those
options apply to every format, since the HTML is what a custom command converts.
Source§impl App
impl App
Sourcepub fn open_export_theme_modal(&mut self)
pub fn open_export_theme_modal(&mut self)
Push the export-theme modal, listing every built-in plus any
user-authored theme in themes/.
Source§impl App
impl App
Sourcepub fn open_markdown_cheat_sheet(&mut self)
pub fn open_markdown_cheat_sheet(&mut self)
Open the Markdown syntax cheat-sheet popover.
Sourcepub fn open_about_modal(&mut self)
pub fn open_about_modal(&mut self)
Open the About page. Touches no network — its [ Check for updates ] button is the only
thing that reaches GitHub (see App::open_update_modal).
Sourcepub fn open_command_palette(&mut self)
pub fn open_command_palette(&mut self)
Open the fuzzy-searchable command palette.
Sourcepub fn dispatch_action(
&mut self,
action: Action,
doc_height: usize,
doc_width: usize,
)
pub fn dispatch_action( &mut self, action: Action, doc_height: usize, doc_width: usize, )
Dispatch a resolved Action through the unified pipeline. The run-loop keystroke arm
and the command palette both funnel through here, so handle_app_action, the dirty-quit
guard, edit_ops::apply, scroll tracking, flashes, and link-follow draining are sequenced
in exactly one place.
Sourcepub fn enter_read_only_diff(&mut self, old: String, new: String) -> bool
pub fn enter_read_only_diff(&mut self, old: String, new: String) -> bool
Install a read-only review of old vs new and enter diff mode — the --diff
difftool presentation.
Separate from Self::enter_diff_mode rather than a flag on it: there is no vim command
line to tear down, no search flow to end, and no intro modal (it teaches an accept/reject
vocabulary this review lacks). What it shares is DiffState::new refusing an empty hunk
list and EditorState::enter_diff_mode as the single door into Mode::Diff.
The buffer is seeded with the old side so the review reads like every other one (buffer =
before, new_buffer = after). dirty stays false and file_path stays None, so
nothing has a path to save over.
false when the two files are byte-identical: git invokes a difftool only for paths it
believes differ, but a whitespace- or mode-only change can still reach us.
Sourcepub fn set_diff_label(&mut self, label: Option<String>)
pub fn set_diff_label(&mut self, label: Option<String>)
Set the status-bar label for a difftool session (see App::diff_label).
Sourcepub fn open_settings_overlay(&mut self)
pub fn open_settings_overlay(&mut self)
Open the settings overlay.
Sourcepub fn open_welcome_modal(&mut self)
pub fn open_welcome_modal(&mut self)
Open the welcome modal on demand, ignoring config.editor.show_welcome and rebuilding
from the live capabilities — so it doubles as the “my terminal changed” entry point.
Guarded against stacking two copies.
Sourcepub fn open_theme_picker(&mut self)
pub fn open_theme_picker(&mut self)
Open the fuzzy-searchable theme picker; selecting a row writes config.theme, saves, and
reapplies the palette live.
Sourcepub fn open_keybinds_overlay(&mut self)
pub fn open_keybinds_overlay(&mut self)
Open the keybinds overlay, building a live KeyMap if there isn’t one yet.
Sourcepub fn open_insert_table_modal(&mut self)
pub fn open_insert_table_modal(&mut self)
Open the rows/columns prompt. The caller must have verified the location precondition
via crate::editor::table_edit::can_insert_table.
Sourcepub fn open_save_as_modal(&mut self, after_save: Option<AfterSave>)
pub fn open_save_as_modal(&mut self, after_save: Option<AfterSave>)
Open the “Save As” path-entry modal, seeded from the buffer’s current path. On submit
the buffer is written and re-pointed via Self::save_buffer_as; after_save then runs,
which is how the save-then-quit / save-then-navigate flows finish a deferred action.
Source§impl App
impl App
Sourcepub fn flash(&mut self, text: impl Into<String>, kind: MessageKind)
pub fn flash(&mut self, text: impl Into<String>, kind: MessageKind)
Emit a transient hint-line message for passive confirmations the user can safely
miss. Use Self::notify for anything that needs acknowledgement.
Source§impl App
impl App
Sourcepub fn open_post_upgrade_modal(&mut self)
pub fn open_post_upgrade_modal(&mut self)
Open the release notes on demand — the About page’s [ Release notes ] button.
Always shows the modal, even without a changelog section for this version: a question the user just asked gets answered. Reads and writes no bookkeeping — looking is not being notified, so this neither arms nor disarms the startup notice.
Source§impl App
impl App
Sourcepub fn open_search_modal(&mut self)
pub fn open_search_modal(&mut self)
Open the search/replace modal, pre-filled from (and tearing down) any active flow.
Source§impl App
impl App
Sourcepub fn open_section_picker(&mut self, doc_width: usize)
pub fn open_section_picker(&mut self, doc_width: usize)
Open the “Go to section” modal, preselecting the nearest heading at or before the cursor.
doc_width must be the live document area width, so the modal’s previewed target_scroll
lands at the same row the editor will paint.
Source§impl App
impl App
Sourcepub fn open_update_modal(&mut self)
pub fn open_update_modal(&mut self)
Open the update modal on demand (About page button, CheckForUpdates action).
Always re-fetches, ignoring the daily throttle — that gate bounds unattended
chatter. A cached positive result (Inconclusive included) is shown meanwhile so
the modal isn’t blank; a cached failure is not, since answering a just-asked
question with a stale “couldn’t check” is worse than showing the fetch in progress.
Source§impl App
impl App
Sourcepub fn new(
config: Config,
state: State,
keybindings: KeyBindingOverrides,
theme_file: ThemeFile,
file_path: Option<PathBuf>,
capabilities: Capabilities,
config_warnings: Vec<ConfigWarning>,
) -> Result<Self>
pub fn new( config: Config, state: State, keybindings: KeyBindingOverrides, theme_file: ThemeFile, file_path: Option<PathBuf>, capabilities: Capabilities, config_warnings: Vec<ConfigWarning>, ) -> Result<Self>
Create the app, loading the file if one is given.
Sourcepub fn with_startup_anchor(self, anchor: Option<String>) -> Self
pub fn with_startup_anchor(self, anchor: Option<String>) -> Self
Record the #section the command line named, applied on the first frame. A builder
rather than a new parameter: only main sets it, and every other site wants the default.
Sourcepub fn with_clipboard(self, clipboard: Box<dyn ClipboardSource>) -> Self
pub fn with_clipboard(self, clipboard: Box<dyn ClipboardSource>) -> Self
Install the clipboard the app reads and writes — main passes
crate::clipboard::default_source. A builder for the same reason as
Self::with_startup_anchor, and so that nothing else reaches the real clipboard.
Sourcepub fn capabilities(&self) -> &Capabilities
pub fn capabilities(&self) -> &Capabilities
Expose detected capabilities to later phases (mouse, images, etc.).
Sourcepub fn run(
&mut self,
terminal: Terminal<CrosstermBackend<Stdout>>,
) -> Result<()>
pub fn run( &mut self, terminal: Terminal<CrosstermBackend<Stdout>>, ) -> Result<()>
Run the event loop until the user quits. The body is deliberately a flat sequence of
named calls into [event_loop], so the control flow is legible at a glance.
Sourcepub fn diff_stop_walk(&self) -> bool
pub fn diff_stop_walk(&self) -> bool
True when a difftool session ended via Quit — see
App::diff_stop_walk.
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl !UnwindSafe for App
impl Unpin for App
impl UnsafeUnpin 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, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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