Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 24 fields pub screen: Screen, pub status_msg: Option<String>, pub should_quit: bool, pub project: Project, pub settings: Settings, pub theme: Theme, pub active_contexts: HashSet<String>, pub file_index: SharedFileIndex, pub stashed_commit_window: Option<Box<CommitWindow>>, pub stashed_primary: Option<Screen>, pub stashed_terminal: Option<Box<TerminalView>>, pub registers: Registers, pub clipboard: Option<Clipboard>, pub schema_cache: HashMap<String, Arc<Value>>, pub file_selector_search: Option<JoinHandle<()>>, pub file_watcher: FileWatcher, pub issue_registry: IssueRegistry, pub task_registry: TaskRegistry, pub task_executor: TaskExecutor, pub log_store: LogStore, pub task_config: Option<TasksFile>, pub status_bar_clicks: StatusBarClickState, pub context_menu: Option<ContextMenu>, pub project_search_cancel: Option<CancellationToken>,
}

Fields§

§screen: Screen§status_msg: Option<String>§should_quit: bool§project: Project§settings: Settings§theme: Theme§active_contexts: HashSet<String>

Derived each frame by recompute_contexts — never mutated directly.

§file_index: SharedFileIndex

Background file index shared with every FileSelector instance. None while the initial walk is still running.

§stashed_commit_window: Option<Box<CommitWindow>>

Stashed CommitWindow — preserved when navigating to another screen so state (staged files, message, cursor, etc.) survives a round-trip.

§stashed_primary: Option<Screen>

Stashed primary screen — preserved when opening a modal so that a primary view (Editor, Terminal, CommitWindow, GitHistory) can be restored when modals close. Stores the full Screen value.

§stashed_terminal: Option<Box<TerminalView>>

Stashed TerminalView — preserved when navigating away so PTY sessions survive switching to the file selector or editor and back.

§registers: Registers

Authoritative clipboard history (yank ring).

§clipboard: Option<Clipboard>

System clipboard handle — initialised once at startup, best-effort. None when the OS clipboard is unavailable (headless systems, etc.).

§schema_cache: HashMap<String, Arc<Value>>

Parsed schema cache: maps schema JSON -> parsed Value. Primary cache stored on AppState so completion tasks can reuse the same parsed tree. This map is mutated only on the main thread while AppState is mutable (e.g., when handling operations); background tasks must be given a cloned Arc<serde_json::Value> to avoid concurrent mutation.

§file_selector_search: Option<JoinHandle<()>>

Handle for the currently in-flight async file-selector search task. Aborted (and replaced) each time the filter changes.

§file_watcher: FileWatcher

Global file watcher for detecting external modifications.

§issue_registry: IssueRegistry

Central in-memory store for all IDE issues (ephemeral + persistent). Ephemeral issues are cleared on IDE restart (new registry = empty). The Persistent Component populates this via load_persistent at startup.

§task_registry: TaskRegistry

Central scheduler for all named-queue tasks (build, lint, test, etc.). Lives on the main thread; async workers communicate results via op_tx.

§task_executor: TaskExecutor

Async process runner — spawns tasks and streams their output.

§log_store: LogStore

On-disk log storage for task output.

§task_config: Option<TasksFile>

Parsed task configuration from .oo/tasks.yaml.

None if the file does not exist or failed validation.

§status_bar_clicks: StatusBarClickState

Click regions produced by the last status-bar render. Used by handle_mouse to dispatch menu/cancel actions.

§context_menu: Option<ContextMenu>

Currently open context menu, if any.

Set by Operation::OpenContextMenu, cleared by Operation::CloseContextMenu or when the user selects an item. app.rs intercepts input and renders the menu as a floating overlay when this is Some.

§project_search_cancel: Option<CancellationToken>

Cancellation token for any in-flight project-wide search spawned from the editor’s Expanded search bar. Replaced (and the old token cancelled) each time a new search starts.

Implementations§

Source§

impl AppState

Source

pub fn new( screen: Screen, project: Project, settings: Settings, file_index: SharedFileIndex, ) -> Self

Source

pub fn recompute_contexts(&mut self)

Called once per frame, after operations are applied. Each subsystem contributes its own tags — no push/pop anywhere else.

Source§

impl AppState

Source

pub fn open_file_preserving_stash(&mut self, path: PathBuf) -> bool

Replace the active screen.

Opens a file while preserving any stashed primary view state.

This is the state-management core of Operation::OpenFile: it flushes any stashed editor into project.editor_state so that take_buffer can restore unsaved changes, cursor, and undo history for the target file.

Returns true if the file was opened successfully, false on I/O error.

Source

pub fn set_screen(&mut self, new_screen: Screen) -> Option<Screen>

If transitioning from a Primary -> Modal view and no primary is currently stashed, move the previous screen into stashed_primary and return None (caller should not attempt to consume the previous screen). Otherwise return Some(prev) so callers can run consume_prev_screen.

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.