diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 09:22:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 09:29:11 -0300 |
| commit | e617ee11b6fafd48278ef0e371fa1981f8559413 (patch) | |
| tree | 106b973366d1905e38b009b8b5b1d3005b8eb4ba /src/exec.zig | |
| parent | 3eb166e287ec5afbd54b03a86711610e1b5269b6 (diff) | |
| download | pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.tar.gz pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.zip | |
history: a +History row reads `Restore <label>` before its date, size and panes, and a click on that Restore (an exec, or a look) is a Restore of that row's dump, exec.operandAt expanding the word to the label beside it as the row reads, where a bare Restore would have been this session's last dump; a look of the whole row reads past the word; the behaviour test clicks a row's Restore and looks at a row
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/exec.zig b/src/exec.zig index 96902889..06752ffd 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -215,7 +215,13 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l const source_col: usize = @intCast(@max(0, col)); if (source_col < word_from or word_from > line.len) return result; const word = look.expandedWord(line[word_from..], source_col - word_from) orelse return result; - const b: look.ExpandedWord = .{ .lo = word.lo + word_from, .hi = word.hi + word_from }; + var b: look.ExpandedWord = .{ .lo = word.lo + word_from, .hi = word.hi + word_from }; + // A +History row's `Restore` is that row's: a click on it (an exec, + // or a look) takes the label beside it, as the row reads. + if (look.isHistoryList(pane) and std.mem.eql(u8, line[b.lo..b.hi], "Restore")) { + const rest = std.mem.trimStart(u8, line[b.hi..], " "); + if (std.mem.startsWith(u8, rest, "pardes-")) b.hi = (line.len - rest.len) + (std.mem.indexOfAny(u8, rest, " \t") orelse rest.len); + } const lo = std.math.cast(i32, b.lo) orelse return result; const hi = std.math.cast(i32, b.hi) orelse return result; result.text = line[b.lo..b.hi]; |
