diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
| commit | 0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch) | |
| tree | f2e288668decded9276ebc45907f16d651b06f9e /core/edit.zig | |
| parent | 2ab05b536bc3b063666b5aaab497157adc2a9120 (diff) | |
| parent | bf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff) | |
| download | pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip | |
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/edit.zig')
| -rw-r--r-- | core/edit.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/edit.zig b/core/edit.zig index d91620c4..0014f681 100644 --- a/core/edit.zig +++ b/core/edit.zig @@ -110,7 +110,7 @@ pub fn clipRequest(p: *Pardes, id: usize, mode: Paste) void { /// (Term.paste). pub fn typeToTty(p: *Pardes, id: usize, pane: *const Pane, text: []const u8) void { if (text.len == 0) return; - const cp = p.scratch.allocator().dupe(u8, text) catch |err| return p.reportError(id, "paste", err); + const cp = p.scratch.allocator().dupe(u8, text) catch |err| return p.reportError(.at(id), "paste", err); for (panes.Term.paste(pane.terminal, cp)) |part| if (part.len > 0) p.emitWrite(id, part); } @@ -122,7 +122,7 @@ pub fn applyPaste(p: *Pardes, whole: []const u8) Error!void { const bytes = if (whole.len > limit) whole[0..modal.graphemeStart(whole, limit)] else whole; if (whole.len > limit) { var said: pardes.Kind.Buf(96) = .{}; - p.setMessage(v.active, said.print("paste cut at its limit, {d} KiB: the rest left out", .{limit / 1024})); + p.setMessage(.at(v.active), said.print("paste cut at its limit, {d} KiB: the rest left out", .{limit / 1024})); } // A prompt answering for a header takes the paste, as it takes keys. const asking = if (p.panes[v.active]) |active| active.prompt != .none else false; @@ -184,7 +184,7 @@ pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void { defer v.register = named; // A kind's pane: what it has selected (Kind.Slot.selection). if (pane.addon) |k| { - if (k.selection.len > 0) setYank(p.editor(), k.selection) catch |err| p.reportError(p.view().active, "yank", err); + if (k.selection.len > 0) setYank(p.editor(), k.selection) catch |err| p.reportError(.at(p.view().active), "yank", err); return; } if (pane.body.nsel > 0 and !main_only) { @@ -192,7 +192,7 @@ pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void { } else { const others = pane.body.nsel; pane.body.nsel = 0; - normalYank(p.editor(), &pane.body) catch |err| p.reportError(p.view().active, "edit", err); + normalYank(p.editor(), &pane.body) catch |err| p.reportError(.at(p.view().active), "edit", err); pane.body.nsel = others; } } @@ -643,7 +643,7 @@ fn editText(e: Editor, t: *Text, lo: i32, hi: i32, col: i32) Error!?panes.EditTe // with Tab or B2, gone when the program draws again. Said at its first // edit, so it never looks like an edit that was lost. if (fresh) for (e.p.panes, 0..) |slot, id| if (slot == pane) - e.p.setMessage(id, "a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b types to the program)"); + e.p.setMessage(.at(id), "a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b types to the program)"); return .{ .text = pane.ovl.?.text, .row0 = pane.ovl.?.row }; } @@ -2352,7 +2352,7 @@ test "flat text replacement preserves a terminal fragment origin and direction" if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 12 }); defer p.deinit(); - p.update(.{ .output = .{ .pane = 0, .bytes = "first\r\nsecond\r\nthird\r\n界a\r\n" } }); + p.update(.{ .output = .{ .pane = .at(0), .bytes = "first\r\nsecond\r\nthird\r\n界a\r\n" } }); const pane = p.panes[0].?; pane.body.mode = .normal; pane.body.cur_pinned = true; @@ -2487,7 +2487,7 @@ test "a paste into a terminal is xterm's: bracketed when the program asked, cont fn f(pp: *Pardes, o: *std.ArrayList(u8)) ![]const u8 { o.clearRetainingCapacity(); while (pp.nextEffect()) |effect| { - if (effect == .write and effect.write.pane == 0) try o.appendSlice(pp.gpa, effect.write.bytes.slice()); + if (effect == .write and effect.write.pane.index() == 0) try o.appendSlice(pp.gpa, effect.write.bytes.slice()); } return o.items; } @@ -2496,7 +2496,7 @@ test "a paste into a terminal is xterm's: bracketed when the program asked, cont try std.testing.expectEqual(.tty, p.panes[0].?.body.mode); p.update(.{ .paste = "echo a\nb\x03\tc" }); try std.testing.expectEqualStrings("echo a\rb \tc", try take(p, &out)); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?2004h" } }); + p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b[?2004h" } }); _ = try take(p, &out); p.update(.{ .paste = "x\x1b[201~y\n" }); try std.testing.expectEqualStrings("\x1b[200~x [201~y\n\x1b[201~", try take(p, &out)); |
