summaryrefslogtreecommitdiff
path: root/core/normal.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/normal.zig')
-rw-r--r--core/normal.zig22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/normal.zig b/core/normal.zig
index 307f1296..e1af647d 100644
--- a/core/normal.zig
+++ b/core/normal.zig
@@ -259,7 +259,7 @@ fn objectJump(e: Editor, t: *Text, text: []const u8, range: modal.Selection, obj
const tree = nodeTree(e, t, text) orelse return;
var last = range;
for (0..count) |_| {
- const s = syntax.objectNext(tree.path, tree.root, tree.text, object, forward, tree.in(modal.selectionCursor(text, last))) orelse break;
+ const s = syntax.objectNext(tree.path, tree.root, tree.text, object, forward, tree.in(modal.selectionCursor(text, last)), null) orelse break;
const next: modal.Selection = .{ .anchor = tree.out(s.from, false), .head = tree.out(s.to, s.to > s.from) };
if (std.meta.eql(next, last)) break;
last = next;
@@ -1107,12 +1107,20 @@ pub fn textAction(e: Editor, t: *Text, a: modal.Normal.Action) edit.Error!void {
if (comptime Editor.lib) return;
// typed again by a macro, Esc is only helix's
if (e.p.macro.replaying > 0) return;
- // The first Esc clears a search's tints (pick-ui SPEC §7.3,
- // §10.4's first step); its word stays in the trail, dimmed.
- if (t.what == .body) if (t.pane()) |pane| if (pane.places.started and pane.places.provenance == .search) {
+ // At rest a thing at a time (pick-ui SPEC §10.4): a search's
+ // tints (its word stays in the trail, dimmed: §7.3), then the
+ // warnings and errors, then the selections (the primary kept);
+ // with none of them left, the previous pane.
+ if (e.p.panes[e.p.view().active]) |pane| if (t == &pane.body and (pane.places.pattern.len > 0 or pane.places.hits.items.len > 0)) {
pane.places.clear(e.p.gpa);
+ e.p.needs_frame = true;
return;
};
+ if (e.p.messages.retire(&.{ .warn, .@"error" }) > 0) return;
+ if (t.nsel > 0) {
+ t.nsel = 0;
+ return;
+ }
tagline.exitHeader(e.p); // out of a header too, as Shift-Esc
return exec.runBuiltin(e.p, .Last, e.p.view().active, "", null);
},
@@ -1335,7 +1343,7 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) edit.Error!
.view_scroll_down => if (t.what == .body) return t.scrollViewMove(p.settings.tab, text, range, 1),
.view_scroll_up => if (t.what == .body) return t.scrollViewMove(p.settings.tab, text, range, -1),
// The next and the previous of the changes this view shows (jj.zig).
- .goto_change => if (@import("jj.zig").nextChange(p, pane, @intCast(@max(0, t.cur_row)), a.forward)) |line|
+ .goto_change => if (@import("jj.zig").nextChange(p, pane, @intCast(@max(0, t.cur_row)), a.forward, std.math.maxInt(usize))) |line|
return pointMove(p.settings.tab, t, text, range, modal.lineStartOffset(text, line)),
.goto_diagnostic, .goto_diagnostic_end => {
// Once a Diagnostics query fed them, the diagnostics are this
@@ -1408,7 +1416,9 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) edit.Error!
const was = pane.places.current;
pane.places.step(p, pane, a.role == .search_next, a.count, t.select);
return Prompt.stepped(p, v.active, a.role == .search_next, was);
- } else
+ } else if (t.what == .body and panes.Pick.walkList(p, v.active, a.role == .search_next))
+ return
+ else
return searchStep(p.editor(), t, text, a.role == .search_next, a.count),
.goto_word => return startJump(p, pane, t),
.macro_record => {