pub struct SidebarComponent { /* private fields */ }Implementations§
Source§impl SidebarComponent
impl SidebarComponent
Sourcepub fn from_settings(vault: Arc<NoteVault>, settings: &AppSettings) -> Self
pub fn from_settings(vault: Arc<NoteVault>, settings: &AppSettings) -> Self
Build a sidebar from the application settings, pulling its key bindings
and icons from settings. The shared constructor for the screens that
host a sidebar (Editor and Browse), so the kb/icons wiring lives once.
pub fn new( key_bindings: KeyBindings, vault: Arc<NoteVault>, icons: Icons, settings: &AppSettings, ) -> Self
pub fn current_dir(&self) -> &VaultPath
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true until a directory has been loaded (no engine yet). The editor
uses this to decide whether to issue the first-open navigation.
(Re)build the engine for dir, replacing any prior listing. This is the
single directory-navigation entry point: changing directory = rebuild
the engine with a fresh DirListingSource for the new dir.
Sourcepub fn refresh_if_showing(&mut self, dir: &VaultPath, tx: &AppTx)
pub fn refresh_if_showing(&mut self, dir: &VaultPath, tx: &AppTx)
Rebuild the listing only when it is currently showing dir, so a
create/rename/delete/move in that directory is reflected without yanking
the user away from an unrelated directory they browsed to. A no-op
otherwise. Shared by every screen that hosts a sidebar.
Sourcepub fn set_open_note(&mut self, path: Option<VaultPath>)
pub fn set_open_note(&mut self, path: Option<VaultPath>)
Set (or clear) the note the editor currently has open, then re-stamp the marker on the live rows. The editor calls this on every open and on an open-note rename.
Sourcepub fn update_note_row(&mut self, path: &VaultPath, new_title: &str)
pub fn update_note_row(&mut self, path: &VaultPath, new_title: &str)
Update the title of the row whose note path matches path, if it is in
the current listing. Called when a note is saved and its title (first
body line) may have changed. Position is left unchanged (no re-sort).
Sourcepub fn rename_note_row(&mut self, from: &VaultPath, to: &VaultPath)
pub fn rename_note_row(&mut self, from: &VaultPath, to: &VaultPath)
Move the row at from to to (path + filename + journal_date) in
place, for a same-directory note rename. Position is left unchanged
(no re-sort). journal_date is recomputed so a rename into/out of a
YYYY-MM-DD name under the journal directory flips the glyph and the
secondary date line correctly.
Sourcepub fn set_current_dir(&mut self, dir: VaultPath)
pub fn set_current_dir(&mut self, dir: VaultPath)
Seed the directory the sidebar will show before its first navigate.
Lets a screen open at a non-root path while keeping current_dir the
single source of truth for the browsed directory.
Sourcepub fn current_sort(&self) -> (SortField, SortOrder)
pub fn current_sort(&self) -> (SortField, SortOrder)
Current sort field/order for the active listing.
Sourcepub fn group_dirs(&self) -> bool
pub fn group_dirs(&self) -> bool
Current “group directories first” flag.
Sourcepub fn apply_sort(
&mut self,
field: SortField,
order: SortOrder,
group_dirs: bool,
)
pub fn apply_sort( &mut self, field: SortField, order: SortOrder, group_dirs: bool, )
Apply a sort selection from the sort dialog and reload so the source re-orders the listing.
Sourcepub fn is_current_journal(&self) -> bool
pub fn is_current_journal(&self) -> bool
true when the active directory is the journal (so its sort default is
the journal one). Lets the caller persist to the matching settings.
Sourcepub fn save_default(
&mut self,
field: SortField,
order: SortOrder,
group_dirs: bool,
)
pub fn save_default( &mut self, field: SortField, order: SortOrder, group_dirs: bool, )
Save the dialog’s selection as the in-session default for the active
context (journal vs. normal), then apply it live. Without this, the
cached per-context defaults that sort_for/navigate read stay at their
construction-time values, so a saved default would have no effect until
restart. The caller is responsible for persisting to the settings file.
Trait Implementations§
Source§impl Component for SidebarComponent
impl Component for SidebarComponent
Source§fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState
fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState
AppEvents through tx for app-level effects.
Returns whether this component consumed the event.Source§fn hint_shortcuts(&self) -> Vec<(String, String)>
fn hint_shortcuts(&self) -> Vec<(String, String)>
(key_display, label).fn render( &mut self, f: &mut Frame<'_>, rect: Rect, theme: &Theme, focused: bool, )
Auto Trait Implementations§
impl !RefUnwindSafe for SidebarComponent
impl !Sync for SidebarComponent
impl !UnwindSafe for SidebarComponent
impl Freeze for SidebarComponent
impl Send for SidebarComponent
impl Unpin for SidebarComponent
impl UnsafeUnpin for SidebarComponent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more