diff options
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]; |
