twrite_core/effect.rs
1/// App-level requests a hook cannot fulfil on its own (file I/O, quit).
2///
3/// Hooks push these into [`crate::HookContext::effects`]; frontends drain the
4/// queue after each event. This keeps `twrite-core` headless while letting
5/// hook-only code (vim `:w` / `:q` / `:e`) drive full editor workflows.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum HookEffect {
8 /// Save the buffer (`None` = current path, error if unknown).
9 Save {
10 /// Explicit destination path, if any.
11 path: Option<String>,
12 },
13 /// Load a file into the buffer, resetting undo history.
14 Load {
15 /// File path to load.
16 path: String,
17 },
18 /// Request application exit.
19 Quit {
20 /// Skip dirty-buffer checks.
21 force: bool,
22 },
23 /// Show a transient message (status line, prompt error area).
24 Message(String),
25}