summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 07:44:55 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit0db7861d9da09e059fa1b9e40fff5cd52add27f2 (patch)
tree6e95dfa36e07b3234b1d5cdb990b11f95c184a3f /src/look.zig
parentd3742ddf2b3a85eb3935cb35e958fa27f1293a6b (diff)
parentdee94c740bdaea61ff35b4e0a7f1d2815c9ee441 (diff)
downloadpardes-0db7861d9da09e059fa1b9e40fff5cd52add27f2.tar.gz
pardes-0db7861d9da09e059fa1b9e40fff5cd52add27f2.zip
integration: the text pane a library (pardes-editor), with the GPU move, the terminal, the plumber and the diff work
A merge of pardes-next (wmrtztwl) and editor-lib (rlumrxuq), no conflicts. Gated against the baseline of the integration line (.scratch/sketch/gpu/mbase): the merge with the library before its follow-up, in full: frame corpus 77/77 identical in Debug and in ReleaseFast, the gated window -0.019% instructions (threshold 0.5%), unit-test on gui 1584/1592 with no failure the baseline has not; this merge: corpus 77/77 in Debug, unit-test on gui 1584/1592, on tui core-test 811/950 (139 skipped), shell-test 990/993, lib-test, hxdiff 658, parity 738, hxgolf 124, hxlib 538 and its parity 618, all 0 mismatches, replicas pass. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/look.zig b/src/look.zig
index 136a7a9c..62f6a7da 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -296,7 +296,7 @@ pub fn cursorWordSel(p: *Pardes, pane: *Pane) Pane.Sel {
const vcol = if (pane.file != null)
w.pad + panes.File.displayOffset(pane, pane.body.cur_row, w.at, pane.body.cur_col) + @as(i32, panes.File.gutterWidth(pane))
else blk: {
- const lines = edit.paneCursorLines(p, &pane.body) catch break :blk pane.body.cur_col;
+ const lines = edit.paneCursorLines(p.editor(), &pane.body) catch break :blk pane.body.cur_col;
const local = pane.body.cur_row;
if (local < 0 or @as(usize, @intCast(local)) >= lines.len) break :blk pane.body.cur_col;
break :blk panes.File.lineDisplayOffset(lines[@intCast(local)], @intCast(@max(0, w.at)), @intCast(@max(0, pane.body.cur_col)));
@@ -372,7 +372,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, start: SearchStart,
@memcpy(out[0..out_len], rows[0..out_len]);
nrows = std.mem.count(u8, rows, "\n");
} else {
- const lines = try edit.paneCursorLines(p, &pane.body);
+ const lines = try edit.paneCursorLines(p.editor(), &pane.body);
// a real file names itself; a terminal or an output buffer has no path
const has_path = if (pane.file) |f| f.output == null else false;
var idbuf: [16]u8 = undefined;
@@ -547,7 +547,7 @@ pub fn wordSpan(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, realbuf:
}
fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usize) ?Pane.LookSpot {
- const lines = edit.paneCursorLines(p, &pane.body) catch return null;
+ const lines = edit.paneCursorLines(p.editor(), &pane.body) catch return null;
const nrows: i32 = @intCast(lines.len);
if (nrows == 0) return null;
const grain: panes.Output.Grain = if (pane.file) |*f| panes.Output.grain(f.output) else .word;
@@ -636,7 +636,7 @@ pub fn lookWalk(p: *Pardes, delta: i32) void {
}
fn landLookSpot(p: *Pardes, id: usize, pane: *Pane, spot: Pane.LookSpot) void {
- edit.pinPaneCursor(p, &pane.body); // fresh out of tty mode the cursor still tracks the shell
+ edit.pinPaneCursor(p.editor(), &pane.body); // fresh out of tty mode the cursor still tracks the shell
pane.body.vsel = .{ .active = true, .row = spot.row, .col = spot.col1, .explicit = true };
pane.body.nsel = 0;
pane.body.cur_row = spot.row;
@@ -751,7 +751,7 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at: Spot, landing: enum { center, ke
}
fn selectSpan(p: *Pardes, pane: *Pane, at: Spot) void {
- const text = edit.flatSurface(p, &pane.body) catch |err| return p.reportError(p.view().active, "look", err);
+ const text = edit.flatSurface(p.editor(), &pane.body) catch |err| return p.reportError(p.view().active, "look", err);
// saturating, not `- 1`: `f.zig:0-5` is a legal thing to type and a
// 1-based zero is the same nothing an absent number is
const acol: i32 = @intCast(at.col -| 1);
@@ -1185,7 +1185,7 @@ fn closeAndMiss(p: *Pardes, id: usize, opened: usize, name: []const u8, why: []c
fn lookTerminalAddress(p: *Pardes, id: usize, target: usize, expr: []const u8) void {
const Addr = @import("ninep/addr.zig").Addr;
const pane = p.panes[target].?;
- const lines = edit.paneCursorLines(p, &pane.body) catch return missed(p, id, "{s}", .{"out of memory"});
+ const lines = edit.paneCursorLines(p.editor(), &pane.body) catch return missed(p, id, "{s}", .{"out of memory"});
var text: std.ArrayList(u8) = .empty;
const arena = p.scratch.allocator();
const row: usize = @intCast(@max(0, pane.body.cur_row));
@@ -1490,7 +1490,7 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void {
if (found == .pane and found.pane.id < MAX_PANES) if (p.panes[found.pane.id]) |shown| {
// A terminal's lines are its logical lines, as a +Search lists them.
const n = if (shown.file) |*f| panes.File.nlines(p.gpa, f) else if (shown.isTerminal())
- if (edit.paneCursorLines(p, &shown.body)) |ls| ls.len else |_| std.math.maxInt(usize)
+ if (edit.paneCursorLines(p.editor(), &shown.body)) |ls| ls.len else |_| std.math.maxInt(usize)
else
std.math.maxInt(usize);
if (pl.at.line > n) return missedLine(p, id, trimmed, pl.at.line);
@@ -2515,7 +2515,7 @@ test "LookNext in a command pane walks its own file:line places, whoever walked
exec.runBuiltin(p, .LookNext, p.view().active, "", null);
try std.testing.expectEqual(dst, p.view().active);
const first = cmd.look_at orelse return error.NoSpot;
- const lines = try edit.paneCursorLines(p, &cmd.body);
+ const lines = try edit.paneCursorLines(p.editor(), &cmd.body);
try std.testing.expect(std.mem.startsWith(u8, lines[@intCast(first.row)][@intCast(first.col0)..], "x.c:3:1"));
exec.runBuiltin(p, .LookNext, p.view().active, "", null);
try std.testing.expectEqual(dst, p.view().active);