ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

commit 36318f5a39dde5d9ba3c434d788030bf8c8c8cd1
parent 745358a0b088a584d2ab0a20ba0e1a403b4997da
Author: Byron Torres <b@torresjrjr.com>
Date:   Thu, 28 Dec 2023 07:42:12 +0000

rename Mode to InputMode

Diffstat:
Mmain.ha | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/main.ha b/main.ha @@ -10,7 +10,7 @@ use strings; type Session = struct { buf: Buffer, - mode: Mode, + mode: InputMode, helpmode: bool, lasterror: (void | Error), suppressmode: bool, @@ -20,9 +20,9 @@ type Session = struct { prev_shcmd: (str | void), }; -type Mode = enum { +type InputMode = enum { COMMAND, - INPUT, + TEXT, }; export fn main() void = { @@ -84,7 +84,7 @@ export fn main() void = { let cmd = Command { ... }; for (true) :repl { - if (s.promptmode && s.mode == Mode::COMMAND) { + if (s.promptmode && s.mode == InputMode::COMMAND) { fmt::error(s.prompt)!; }; @@ -108,7 +108,7 @@ export fn main() void = { }; switch (s.mode) { - case Mode::COMMAND => + case InputMode::COMMAND => const execnow = match (parse(&cmd, input)) { case let e: ParseError => continue; // TODO: print error @@ -120,14 +120,14 @@ export fn main() void = { execute(&s, &cmd): void; //cmd = command { ... }; } else { - s.mode = Mode::INPUT; + s.mode = InputMode::TEXT; continue; }; - case Mode::INPUT => + case InputMode::TEXT => if (input == ".") { execute(&s, &cmd): void; delete(cmd.input[..]); - s.mode = Mode::COMMAND; + s.mode = InputMode::COMMAND; continue; }; debug("repl: input={}", input);