1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// UI mode — determines how keyboard input is interpreted.
#[derive(Clone, Debug, PartialEq, Default)]
pub enum Mode {
/// Default: navigate the grid with arrow keys.
#[default]
Normal,
/// Editing a plain cell value.
Editing,
/// Editing a formula via the tree editor.
FormulaTree,
/// Typing a formula name after `=` (legacy, kept for compatibility).
FormulaName,
/// Entering formula arguments one by one (legacy, kept for compatibility).
FormulaArgs,
/// Typing a `:command` in the footer.
Command,
/// Entering arguments for a command one prompt at a time.
CommandArgs {
cmd: String,
prompts: Vec<&'static str>,
done: Vec<String>,
},
/// Help overlay.
Help,
}
impl Mode {
#[allow(dead_code)]
pub fn label(&self) -> &'static str {
match self {
Mode::Normal => "Normal",
Mode::Editing => "Editing",
Mode::FormulaTree => "Formula",
Mode::FormulaName => "Formula",
Mode::FormulaArgs => "Args",
Mode::Command => "Command",
Mode::CommandArgs {..}=> "Command",
Mode::Help => "Help",
}
}
}