summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/look.zig b/src/look.zig
index 258cf8f5..2e27a001 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -503,7 +503,11 @@ const SearchStart = enum { top, cursor };
pub fn submitSearch(p: *Pardes, id: usize) void {
const pane = p.panes[id] orelse return;
- if (normal.selRegexArmed(pane)) |a| return if (p.promptTarget(pane)) |t| normal.applySelRegex(p, pane, t, a.pat, a.split);
+ 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);
+ return if (p.promptTarget(pane)) |t| normal.applySelRegex(p, pane, t, a.pat, a.mode);
+ }
const armed = pane.promptText() orelse return;
const slash = std.mem.indexOfScalar(u8, armed, '/') orelse return;
if (std.mem.startsWith(u8, armed, config.rename_marker)) return p.lspRequest(id, .rename, armed[slash + 1 ..]);
@@ -1013,7 +1017,7 @@ pub fn clearNavigationSelection(p: *Pardes, pane: *Pane) void {
pane.body.nsel = 0;
pane.body.select = false;
pane.body.normal.clear();
- pane.body.append_at = null;
+ pane.body.restore_cursor = false;
pane.body.sticky_col = -1;
for (0..pane.sel.len) |slot| pane.clearPointerSelection(slot);
pane.sel = @splat(.{});
@@ -1163,6 +1167,13 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void {
pane.search_row = null;
_ = searchStep(p, id, 1);
}
+ // A path that is not there searches for its text, and a search
+ // that found nothing says so rather than leave an empty buffer.
+ const results = if (pane.search_pane) |rid| p.panes[rid] else null;
+ if (results) |r| if (r.file) |f| if (f.content.len == 0) {
+ var said: [96]u8 = undefined;
+ p.setMessage(id, std.fmt.bufPrint(&said, "Look: no match for \"{s}\"", .{@import("Messages.zig").clip(trimmed, 48)}) catch "Look: no match");
+ };
},
.pane => |t| {
if (t.id >= MAX_PANES) return;