diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:17:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 5354090b6122faf0d18e246a55e8a4ead0955394 (patch) | |
| tree | f27fc08bba1ceded6bf315125090ef0b64405463 /src/exec.zig | |
| parent | c742d19d4bacbd9a91627c4859ca8cb0d11bdba7 (diff) | |
| download | pardes-5354090b6122faf0d18e246a55e8a4ead0955394.tar.gz pardes-5354090b6122faf0d18e246a55e8a4ead0955394.zip | |
Term: output and view through the interface: Term.feed takes one read and the rows the core keeps positions on and gives back a Term.Told (where each went, erased or not, cleared, alive, a pin missed), Term.grid is the plain record of the view and the cursor (total, offset, len, the cursor, whether it shows, the view's row or null while it follows), Term.scroll, Term.follow, Term.viewTo, Term.resize (now or for later) and Term.resizeDeferred move it, Term.cellPixels sizes its cells in pixels and Term.replies hands over what it answered its program; the core's half is the core's: Pane.feedOutput and its row tracking (the edit copy's rows, the cursors and selections, their undo and the pointer's rows, gathered as rows and moved as the feed told, ingestWithPositions's core) and Pane.followOutput, Pane.resizeGrid and Pane.panFor in panes.zig with panes.resizeDeferred, the cursor a program shows read from the grid where the body draws it, tape.viewOnly beside tape.authorityOnly; scrollbar, gridOffset, gridCursor, visibleCursor, viewOf, atBottom and their types go; nothing else changes
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/exec.zig b/src/exec.zig index df578d08..69bbe162 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -112,7 +112,7 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l const visible = clicked.r0 - @as(i32, pane.tag_rows); const wrapped = pane.wrapAt(visible); const raw = pane.isTerminal() and pane.body.mode == .tty and clicked.r0 >= pane.tag_rows; - const row = if (raw) panes.terminal.gridOffset(pane) + visible else wrapped.line; + const row = if (raw) @as(i32, @intCast(panes.Term.grid(pane.terminal).offset)) + visible else wrapped.line; const raw_line = if (raw) modal.lineSlice(body_layer.bodyText(p.scratch.allocator(), pane) catch "", @intCast(@max(0, visible))) else ""; const col = if (raw) @as(i32, @intCast(panes.File.rawAtDisplay(raw_line, @intCast(@max(0, clicked.c0))))) @@ -772,8 +772,8 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize { // saved cursor), mouse reports and bracketed paste off, the cursor // shown, colours reset. (Not DECSTR: ghostty's stream does not // implement it.) - if (panes.terminal.onAlternateScreen(pane)) panes.terminal.feedOutput(p, pane, "\x1b[?1049l"); - panes.terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[0m"); + if (panes.terminal.onAlternateScreen(pane)) pane.feedOutput(p, "\x1b[?1049l"); + pane.feedOutput(p, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[0m"); echoCommand(p, pane, line); pane.command_from = winid(p, src); p.emitSpawn(id, pane.serial, pane.cwdSlice()); @@ -823,11 +823,11 @@ fn echoCommand(p: *Pardes, pane: *Pane, line: []const u8) void { var w = std.Io.Writer.fixed(&buf); // A line past the room is cut at its end. echo: { - w.writeAll(if (panes.terminal.gridCursor(pane).x != 0) "\r\n% " else "% ") catch break :echo; + w.writeAll(if (panes.Term.grid(pane.terminal).cursor_x != 0) "\r\n% " else "% ") catch break :echo; for (line) |c| (if (c == '\n') w.writeAll("\r\n") else w.writeByte(c)) catch break :echo; w.writeAll("\r\n") catch break :echo; } - panes.terminal.feedOutput(p, pane, w.buffered()); + pane.feedOutput(p, w.buffered()); } /// Trim and unwrap clickable command-word notation once for every command |
