diff options
Diffstat (limited to 'term.zig')
| -rw-r--r-- | term.zig | 36 |
1 files changed, 29 insertions, 7 deletions
@@ -11,6 +11,23 @@ pub const Sel = struct { r1: i32 = 0, }; +/// Modal input mode. normal/insert are the helix-style text-editing modes; tty +/// forwards keys to the shell (terminal panes only — file panes never use it). +/// normal -> helix NORMAL: hjkl/w/b/e/... move a block cursor; i/a/o -> insert; +/// Esc -> tty (terminals) or stays (files). +/// insert -> keys insert text at the cursor (acme click-and-type); Esc -> normal. +/// tty -> keys -> pty as terminal sequences; a body left-click returns to normal. +pub const Mode = enum { normal, insert, tty }; + +/// A modal line selection (helix `x` extends the selection down line by line). +/// r0/r1 are ABSOLUTE body rows (visual + scroll off). active == false means the +/// cursor is a plain 1-char selection (normal mode default). +pub const LineSel = struct { + active: bool = false, + r0: i32 = 0, + r1: i32 = 0, +}; + pub const EDIT_CAP = 128; // max chars in one insertion run pub const MAX_EDITS = 16; // max concurrent insertion runs per window @@ -62,16 +79,21 @@ vweight: f32 = 1, /// One independent selection per mouse button: 0=left, 1=middle, 2=right. sel: [3]Sel = .{ .{}, .{}, .{} }, -/// modal input. true = "text"/char mode (DEFAULT; keys insert text at the -/// cursor, shell prompts hidden), false = "tty"/sym mode (keys -> pty as -/// terminal sequences, prompts shown). Esc toggles to tty; a left-click returns -/// to text mode and anchors the cursor. -/// -/// The cursor and edits are anchored at ABSOLUTE body rows (visual row + scroll +/// modal input mode (see Mode). DEFAULT is normal (helix): a block cursor that +/// moves with hjkl; i/a/o enter insert; Esc reaches tty on terminals. +mode: Mode = .normal, +/// one pending prefix codepoint (0 = none): `g` (gg/ge/...) and `z` (zt/zz/zb). +pending: u21 = 0, +/// modal line selection from `x` (helix extend-line). In absolute body rows. +msel: LineSel = .{}, +/// cursor and edits are anchored at ABSOLUTE body rows (visual row + scroll /// offset) so they ride the scrollback, not the screen. `cur_off` is the offset /// into the run sitting at (cur_row, cur_col). `cur_pinned` is false until the /// user clicks or types, while which the cursor tracks the shell's cursor. -editing: bool = true, +/// +/// For terminals in normal mode cur_col is a VISUAL column; in insert mode it is +/// the original-tty column the run is anchored at (renderedCol maps it to visual). +/// For file panes cur_col is a content column (no edit runs; edits stay empty). cur_pinned: bool = false, cur_row: i32 = 0, cur_col: i32 = 0, |
