summaryrefslogtreecommitdiff
path: root/src/normal.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/normal.zig')
-rw-r--r--src/normal.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/normal.zig b/src/normal.zig
index 808ac886..ebace536 100644
--- a/src/normal.zig
+++ b/src/normal.zig
@@ -930,7 +930,12 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
.body, .input => tagline.enterTag(p, pane),
},
.pipe_selection => |how| return p.startPrompt(pane, t, .{ .pipe = how }),
- .search => return p.startPrompt(pane, &pane.body, .{ .search = config.search_marker }),
+ // `/` in a text is its query pane's line 1 (Query.zig); a
+ // terminal's still asks on the notice band.
+ .search => if (pane.file != null and t.what == .body)
+ panes.Query.open(p, p.active, .text, "", true)
+ else
+ return p.startPrompt(pane, &pane.body, .{ .search = config.search_marker }),
// In a file's text, n and N step its places while they answer for
// the register (Places.answersN); else helix's search of the register.
.search_step => |step| if (t.what == .body and pane.file != null and pane.places.answersN(p, pane))
@@ -939,12 +944,13 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
return searchStep(p, t, text, step.direction, step.count),
.search_selection => |boundary| {
searchSelection(p, t, text, boundary);
- // The pattern's places: the selection is already on one of them.
- if (t.what == .body and pane.file != null) {
+ // The pattern is line 1 of this text's query pane, made or
+ // reused, the keyboard staying here: n and N step its places.
+ if (t.what == .body and pane.file != null and !pane.hasPdf() and pane.query == null) {
const name = if (p.register != 0) p.register else '/';
const pat = p.registers.value(name, 0) orelse return;
- const r = pane.body.primaryRange(text, 0);
- pane.places.search(p, pane, .search, 0, pat, false, @min(r.anchor, r.head), false);
+ panes.Query.open(p, p.active, .text, pat, false);
+ pane.places.provenance = .search;
}
},
.node => |walk| return nodeSelect(p, pane, t, walk),