summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 20:56:14 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit04b047fb366ea2c595708fb62467f690fce4b9ec (patch)
treeb2b765cbca96bcfd1785a39f60f0e0398a6aabb2 /src/edit.zig
parent9554cc4c544632b01f740f895fd6db9f9952c02e (diff)
downloadpardes-04b047fb366ea2c595708fb62467f690fce4b9ec.tar.gz
pardes-04b047fb366ea2c595708fb62467f690fce4b9ec.zip
Terminal.zig is terminal.zig: a file of functions and no fields takes a namespace's lowercase name
The last of the deferred renames, now that the tty and theme agents have landed: panes.terminal at its importers, the alias lines in Text.zig and File.zig and panes.zig's own uses following. dump.zig's Terminal struct, a dump record, is not this. The served sources list and docs/design.typ name the new file. test/perf.zig's references change, so the three perf baselines take its new harness id with their numbers as recorded. No behaviour changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/edit.zig b/src/edit.zig
index 26062029..98c60efb 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -113,7 +113,7 @@ pub fn clipRequest(p: *Pardes, id: usize, mode: @FieldType(ClipRequest, "mode"))
pub fn typeToTty(p: *Pardes, id: usize, pane: *const Pane, text: []const u8) void {
if (text.len == 0) return;
- if (panes.Terminal.bracketedPaste(pane)) {
+ if (panes.terminal.bracketedPaste(pane)) {
p.emitWrite(id, "\x1b[200~");
p.emitWrite(id, text);
p.emitWrite(id, "\x1b[201~");
@@ -225,7 +225,7 @@ pub fn capturePointerSelection(p: *Pardes, pane: *Pane, slot: usize) !void {
// Refresh the source map before translating the rendered rectangle.
const raw = pane.isTerminal() and pane.body.mode == .tty;
const body = try body_layer.bodyText(p, p.scratch.allocator(), pane);
- const terminal_lines = if (pane.file == null and !raw) try panes.Terminal.cursorLines(p, pane) else &.{};
+ const terminal_lines = if (pane.file == null and !raw) try panes.terminal.cursorLines(p, pane) else &.{};
const first = @max(0, @min(gesture.r0, gesture.r1) - pane.tag_rows);
const logical_rows = if (pane.body_rows > 0) pane.body_rows else pane.rows;
const last = @min(@as(i32, logical_rows) - 1, @max(gesture.r0, gesture.r1) - pane.tag_rows);
@@ -242,7 +242,7 @@ pub fn capturePointerSelection(p: *Pardes, pane: *Pane, slot: usize) !void {
const left: i32 = if (cols.first) cols.lo else prefix;
const right: i32 = cols.hi orelse std.math.maxInt(i32) / 2;
var source = pane.wrapAt(visible);
- if (raw) source = .{ .line = panes.Terminal.gridOffset(pane) + visible, .at = 0 };
+ if (raw) source = .{ .line = panes.terminal.gridOffset(pane) + visible, .at = 0 };
const line = if (raw) modal.lineSlice(body, @intCast(visible)) else pointerSourceLine(pane, terminal_lines, source.line);
var next = pane.wrapAt(visible + 1);
if (raw) next = .{ .line = source.line + 1, .at = 0 };
@@ -256,7 +256,7 @@ pub fn capturePointerSelection(p: *Pardes, pane: *Pane, slot: usize) !void {
.hi = if (right < prefix) lo else if (cols.hi == null) end else @min(end, modal.nextGrapheme(line, at)),
.to_edge = cols.hi == null,
.raw_terminal = raw,
- .prompt_bytes = if (raw) panes.Terminal.promptPrefixBytes(pane, source.line, line) else 0,
+ .prompt_bytes = if (raw) panes.terminal.promptPrefixBytes(pane, source.line, line) else 0,
};
const rendered = modal.lineSlice(body, @intCast(visible));
const prefix_end = @min(rendered.len, @as(usize, @intCast(@min(prefix, right + 1))));
@@ -276,7 +276,7 @@ pub fn selectionText(p: *Pardes, pane: *Pane, sl: Pane.Sel) ![]const u8 {
const arena = p.scratch.allocator();
if (pane.rawPointerText(sl)) |text| return arena.dupe(u8, text);
if (pane.pointerSelection(sl)) |rows| {
- const terminal_lines = if (pane.file == null) try panes.Terminal.cursorLines(p, pane) else &.{};
+ const terminal_lines = if (pane.file == null) try panes.terminal.cursorLines(p, pane) else &.{};
var total: usize = rows.len -| 1;
for (rows) |row| {
const line = pointerSourceLine(pane, terminal_lines, row.row);
@@ -402,7 +402,7 @@ pub fn paneCursorLines(p: *Pardes, t: *Text) ![]const []const u8 {
if (comptime pdf_enabled) return panes.Pdf.textLines(&pane.pdf.?, p.pdf_gpa, arena);
unreachable;
}
- return panes.Terminal.cursorLines(p, pane);
+ return panes.terminal.cursorLines(p, pane);
}
pub fn paneByteAtDisplay(p: *Pardes, t: *Text, row: i32, from_raw: i32, display_col: i32) i32 {
@@ -448,8 +448,8 @@ pub fn flatSurface(p: *Pardes, t: *Text) ![]const u8 {
if (comptime pdf_enabled) return pane.pdf.?.ensureText(p.pdf_gpa);
unreachable;
}
- const lines = try panes.Terminal.cursorLines(p, pane);
- return panes.Terminal.flatSurface(p, pane, lines);
+ const lines = try panes.terminal.cursorLines(p, pane);
+ return panes.terminal.flatSurface(p, pane, lines);
}
pub fn paneWrapWidth(p: *const Pardes, t: *Text) usize {
@@ -474,7 +474,7 @@ fn editText(p: *Pardes, t: *Text, lo: i32, hi: i32, col: i32) ?panes.EditText {
const pane = t.pane() orelse return null;
if (pane.file) |f| return .{ .text = f.content, .row0 = 0 };
if (pane.image != null or pane.hasPdf()) return null;
- return panes.Terminal.editText(p, pane, lo, hi, col);
+ return panes.terminal.editText(p, pane, lo, hi, col);
}
fn editTextEol(p: *Pardes, t: *Text, b: Bounds) ?panes.EditText {
@@ -535,7 +535,7 @@ pub fn setEditTextEnd(p: *Pardes, t: *Text, new: []u8, known_end: ?modal.Cursor)
};
t.last_edit = .{ .row = @as(i32, @intCast(end.row)) + row0, .col = @intCast(end.col) };
if (pane.file) |*f| return panes.File.setContent(p, f, new);
- panes.Terminal.setEditText(p, pane, new);
+ panes.terminal.setEditText(p, pane, new);
}
/// Take a text an edit made that nothing keeps, holding it until the next
@@ -2057,7 +2057,7 @@ pub fn pushUndo(p: *Pardes, t: *Text) void {
}
const pane = t.pane() orelse return;
if (pane.file != null) return panes.File.pushUndo(p, pane);
- panes.Terminal.pushUndo(p, pane);
+ panes.terminal.pushUndo(p, pane);
}
pub fn doUndo(p: *Pardes, t: *Text) void {
@@ -2065,7 +2065,7 @@ pub fn doUndo(p: *Pardes, t: *Text) void {
if (t.what != .body) return;
const pane = t.pane() orelse return;
if (pane.file != null) return panes.File.undo(p, pane);
- panes.Terminal.undo(p, pane);
+ panes.terminal.undo(p, pane);
}
pub fn doRedo(p: *Pardes, t: *Text) void {
@@ -2073,7 +2073,7 @@ pub fn doRedo(p: *Pardes, t: *Text) void {
if (t.what != .body) return;
const pane = t.pane() orelse return;
if (pane.file != null) return panes.File.redo(p, pane);
- panes.Terminal.redo(p, pane);
+ panes.terminal.redo(p, pane);
}
/// Undo or redo an edit of a text's own characters; stepping back past its