diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-08 12:00:28 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-22 10:03:15 -0300 |
| commit | 13d5613b77c62c425c3a124a34c0c2528cc6251f (patch) | |
| tree | f3cbe41683ef31641ea087039db9fc3be81e141f /src/look.zig | |
| parent | 046979b877f02a91cf52cc86b84c5619cb9363d3 (diff) | |
| download | pardes-13d5613b77c62c425c3a124a34c0c2528cc6251f.tar.gz pardes-13d5613b77c62c425c3a124a34c0c2528cc6251f.zip | |
Follow Helix search registers for n/N; keep Look navigation as named builtins
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/look.zig b/src/look.zig index 6ba6a8d0..5795979f 100644 --- a/src/look.zig +++ b/src/look.zig @@ -542,7 +542,10 @@ pub fn submitSearch(p: *Pardes, id: usize) void { const pane = p.panes[id] orelse return; if (normal.selRegexArmed(pane)) |a| { // helix keeps the pattern in `/` - if (a.pat.len > 0) p.registers.put(p.gpa, '/', a.pat, 0, 1, true); + if (a.pat.len > 0) { + p.registers.put(p.gpa, '/', a.pat, 0, 1, true); + p.registers.last_search = '/'; + } return if (p.promptTarget(pane)) |t| normal.applySelRegex(p, pane, t, a.pat, a.mode); } const armed = pane.promptText() orelse return; @@ -556,7 +559,13 @@ pub fn submitSearch(p: *Pardes, id: usize) void { else .text; _ = runSearch(p, id, armed[slash + 1 ..], kind, .top, true) catch |err| return p.reportError(id, "search", err); - if (kind == .text) lookFirstHit(p, id); + if (kind == .text) { + var pattern: std.ArrayList(u8) = .empty; + normal.appendSearchLiteral(&pattern, p.scratch.allocator(), armed[slash + 1 ..]) catch return; + p.registers.put(p.gpa, '/', pattern.items, 0, 1, true); + p.registers.last_search = '/'; + lookFirstHit(p, id); + } } fn lookFirstHit(p: *Pardes, id: usize) void { @@ -2752,7 +2761,6 @@ test "Look on a diff under each git prefix opens the repository's file, and a re } } - test "Look on a diff line is the look of the address it names, selected by hand: a cached patch, the checkout elsewhere" { if (!platform_has_fs) return; const io = std.testing.io; |
