diff options
Diffstat (limited to 'src/Editor.zig')
| -rw-r--r-- | src/Editor.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Editor.zig b/src/Editor.zig index 559ea196..014d1923 100644 --- a/src/Editor.zig +++ b/src/Editor.zig @@ -6,7 +6,12 @@ //! sketch stores (src/lib_editor.zig). Nothing here is kept between calls. const std = @import("std"); const Registers = @import("Registers.zig"); -const Pardes = @import("Core.zig"); + +/// The library's build (build.zig `library`): a text with no pane and no +/// core, its characters its own. Where an edit reaches a pane it branches +/// on this at compile time, so the library never compiles the core. +pub const lib = @import("pardes_config").lib; +const Pardes = if (lib) void else @import("Core.zig"); const Editor = @This(); @@ -30,7 +35,10 @@ multi_count: *usize, /// edit.retireEditText. retired_edit: *?[]u8, /// The core the text's pane is in: what an edit reaches past its text with. -p: *Pardes, +p: if (lib) void else *Pardes, +/// The library's: an edit failed (its allocator ran out) and the key is +/// refused. +failed: if (lib) *bool else void, pub fn of(p: *Pardes) Editor { return .{ @@ -44,11 +52,16 @@ pub fn of(p: *Pardes) Editor { .multi_count = &p.multi_count, .retired_edit = &p.retired_edit, .p = p, + .failed = {}, }; } /// An edit that failed, said on the message row of the pane the keyboard /// is in. pub fn reportError(e: Editor, err: anyerror) void { + if (comptime lib) { + e.failed.* = true; + return; + } e.p.reportError(e.p.view().active, "edit", err); } |
