summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/look.zig b/src/look.zig
index 3d02802a..030aa432 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -2428,7 +2428,7 @@ test "a click, a 9P whole-line look and an empty event write-back take one expan
// An empty record written back to event, at the same byte.
const body = pane.file.?.content;
const line_start = modal.lineStartOffset(body, at.row);
- const written = pardes.ctlfs.events.expandAt(p, pane, body, line_start + at.col, true);
+ const written = pardes.ctlfs.events.expandAt(p, pane, body, line_start + at.col, true, true);
try std.testing.expectEqualStrings(at.want, written);
// A 9P look of the whole line.
if (at.whole_line) {
@@ -2518,7 +2518,7 @@ test "every entry point to Look takes one expansion: a diff line and a file:12:5
},
.event_write_back => {
const body = pane.file.?.content;
- const text = pardes.ctlfs.events.expandAt(p, pane, body, modal.lineStartOffset(body, case.row) + case.col, true);
+ const text = pardes.ctlfs.events.expandAt(p, pane, body, modal.lineStartOffset(body, case.row) + case.col, true, true);
lookAt(p, 0, p.scratch.allocator().dupe(u8, text) catch unreachable);
},
}
@@ -2563,6 +2563,15 @@ test "a tag word looked at by a click and by Enter is one record to an event rea
pane.body.cur_col = 0;
try std.testing.expectEqualStrings("+line", exec.operandAt(p, pane, cursorWordSel(p, pane), false, false).text.?);
try std.testing.expectEqualStrings("src/x.zig:1", exec.operandAt(p, pane, cursorWordSel(p, pane), false, true).text.?);
+ // An exec written back to event (`MX0 0`) takes the word too, on a
+ // header, a hunk header and a marker column; a look, the address.
+ const body = pane.file.?.content;
+ const events = pardes.ctlfs.events;
+ try std.testing.expectEqualStrings("diff", events.expandAt(p, pane, body, 0, true, false));
+ try std.testing.expectEqualStrings("@@", events.expandAt(p, pane, body, modal.lineStartOffset(body, 3), true, false));
+ try std.testing.expectEqualStrings("+line", events.expandAt(p, pane, body, modal.lineStartOffset(body, 5), true, false));
+ try std.testing.expectEqualStrings("src/x.zig", events.expandAt(p, pane, body, 0, true, true));
+ try std.testing.expectEqualStrings("src/x.zig:1", events.expandAt(p, pane, body, modal.lineStartOffset(body, 5), true, true));
// An event reader on the pane.
const event = pardes.ctlfs.Node.of(pane.serial, .event);