From 639a2a7931394742af2a2e6f02006fdfd4dd6052 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 16 Nov 2026 23:19:12 -0300 Subject: text: a terminal's edit overlay and its undo are the Text's: EditBuffer, Snapshot and history_max move from terminal.zig into Text.zig, as they are, so Text names no terminal type (terminal.zig and panes.zig's ovl name them there, as test/panes.zig does); a move, nothing else --- src/terminal.zig | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/terminal.zig') diff --git a/src/terminal.zig b/src/terminal.zig index 46790de1..4ee2e9fa 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -16,7 +16,9 @@ const File = panes.File; const ghostty_vt = @import("ghostty-vt"); -pub const history_max = 64; +const EditBuffer = panes.Text.EditBuffer; +const Snapshot = panes.Text.Snapshot; +const history_max = panes.Text.history_max; pub const VtSlot = ghostty_vt.Terminal; /// A cell of an emulator's pages, as `getCell` reads it (src/echo.zig). @@ -416,23 +418,6 @@ fn asGhostRgb(rgb: [3]u8) GColor.RGB { return .{ .r = rgb[0], .g = rgb[1], .b = rgb[2] }; } -/// The owned text standing in for `rows` live terminal rows, beginning at -/// absolute surface row `row`. The emulator grid remains untouched underneath. -pub const EditBuffer = struct { - row: i32 = 0, - rows: i32 = 1, - text: []u8 = &.{}, -}; - -/// One whole-state terminal edit boundary. Null means the pane has not yet -/// materialized an edit buffer; non-null snapshots own their text. -pub const Snapshot = struct { - ovl: ?EditBuffer, - cur_row: i32, - cur_col: i32, - vsel: panes.Text.CharSel, -}; - pub const PendingCommand = struct { bytes: []u8 = &.{}, wait: enum { none, spawn, input } = .none, -- cgit v1.3