From 5d29c3151e40c05e764a9112d407082df89a19e1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 17:43:56 -0300 Subject: A look takes acme's file:addr and :addr, and one that finds nothing changes nothing A look at `file:/re/` or `:/re/` searched for the words instead of addressing, and a miss left an empty +Search pane and a cleared selection, while a hit answered the +Search pane on /look. Now an address after a colon (acme look.c:450) is evaluated in the file from its dot; a miss says no match and leaves the panes and the selection alone; a hit reads back as the pane the text is selected in. Both live in lookAt's one flow, so they are one change. Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index a755969b..97f7817f 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1109,8 +1109,10 @@ pub const Find = struct { pub const output: OutputTraits = .{ .name = config.search_buffer, .steps = true }; pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); - if (pat.len > 0) return look.runSearch(c.p, c.id, pat, .find, .top) catch |err| - c.p.reportError(c.id, "find", err); + if (pat.len > 0) { + _ = look.runSearch(c.p, c.id, pat, .find, .top, true) catch |err| c.p.reportError(c.id, "find", err); + return; + } c.p.startPrompt(c.pane, &c.pane.body, .{ .search = config.find_marker }); } }; @@ -1123,8 +1125,10 @@ pub const Grep = struct { pub const output: OutputTraits = .{ .name = config.search_buffer, .steps = true, .locations = true }; pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); - if (pat.len > 0) return look.runSearch(c.p, c.id, pat, .grep, .top) catch |err| - c.p.reportError(c.id, "grep", err); + if (pat.len > 0) { + _ = look.runSearch(c.p, c.id, pat, .grep, .top, true) catch |err| c.p.reportError(c.id, "grep", err); + return; + } c.p.startPrompt(c.pane, &c.pane.body, .{ .search = config.grep_marker }); } }; -- cgit v1.3