File tree sub-state: tree data, focus, and backing buffer.
Wraps the file-tree-related fields from EditorState into a single struct with query and mutation helpers. Includes inline editing state for new file, new folder, and rename operations.
Summary
Functions
Cancels inline editing, clearing the editing state back to nil.
Closes the tree and clears the buffer.
Returns true when inline editing is active.
Returns true when the file tree is open and focused.
Opens the tree with the given data, buffer, and focused state.
Returns true when the file tree is open.
Enters inline editing mode at the given index.
Updates the text being typed in the inline editor.
Returns the tree width, or 0 if the tree is not open.
Types
@type editing() :: %{ index: non_neg_integer(), text: String.t(), type: editing_type(), original_name: String.t() | nil }
@type editing_type() :: :new_file | :new_folder | :rename
Inline editing state for creating files/folders or renaming entries.
When non-nil, the user is actively typing a filename in the tree.
The index is the visual position in the visible entry list where
the editing row appears. For new file/folder, this is the insertion
point. For rename, this is the entry being renamed.
@type t() :: %MingaEditor.State.FileTree{ buffer: pid() | nil, editing: editing() | nil, focused: boolean(), project_root: String.t() | nil, tree: Minga.Project.FileTree.t() | nil }
File tree sub-state.
Functions
Cancels inline editing, clearing the editing state back to nil.
Closes the tree and clears the buffer.
Returns true when inline editing is active.
Returns true when the file tree is open and focused.
@spec open(t(), Minga.Project.FileTree.t(), pid() | nil) :: t()
Opens the tree with the given data, buffer, and focused state.
Returns true when the file tree is open.
@spec start_editing(t(), non_neg_integer(), editing_type(), String.t()) :: t()
Enters inline editing mode at the given index.
For new file/folder, initial_text is empty. For rename,
initial_text is the current entry name.
Updates the text being typed in the inline editor.
@spec width(t()) :: non_neg_integer()
Returns the tree width, or 0 if the tree is not open.