summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig21
1 files changed, 13 insertions, 8 deletions
diff --git a/core/panes.zig b/core/panes.zig
index f608e6a3..e4ed3e9d 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -271,6 +271,10 @@ pub const Pane = struct {
/// Its walk: the places it stepped through, its owner when it is a
/// reader, whether it is held (Trail.zig, pick-ui SPEC §6).
trail: Trail = .{},
+ /// The selections its recipe word's sam prompts made (gpa), for Look
+ /// on the word to put back (Prompt.zig, SPEC §7.5).
+ recipe_sels: []modal.Selection = &.{},
+ recipe_pri: u16 = 0,
/// `gw`'s words, labelled in order while it waits for a label to be
/// typed (gpa-owned); `jump_first` is the label's first letter once typed.
jump: std.ArrayList(modal.Selection) = .empty,
@@ -1249,6 +1253,7 @@ pub fn teardownPane(p: *Pardes, pane: *Pane) void {
pane.input.deinit(p.gpa);
pane.jump.deinit(p.gpa);
pane.places.deinit(p.gpa);
+ p.gpa.free(pane.recipe_sels);
@import("jj.zig").forget(p, pane.serial);
if (pane.query) |q| {
q.deinit(p.gpa);
@@ -1906,7 +1911,7 @@ test "a prompt chip is a band with its caret, still on the grid, and only the ch
for (pane.sel) |selection| try std.testing.expect(selection.state == .none);
}
-test "a prompt is typed on its own line in the notice band and leaves the tag row alone" {
+test "a Save prompt is typed on its own line in the notice band and leaves the tag row alone" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
const pane = try p.setTestFile("one two\n");
@@ -1916,13 +1921,13 @@ test "a prompt is typed on its own line in the notice band and leaves the tag ro
const tag_before = try std.testing.allocator.dupe(Cell, p.surface.tag_layers[0].cells);
defer std.testing.allocator.free(tag_before);
- // `s` keeps a prompt on the band (a text's `/` is its query pane's
- // line 1 now, Query.zig).
- p.update(.{ .key = .{ .cp = 's' } });
+ // Save's path keeps a prompt on the band (a body's `s`, `|` and `/`
+ // ask in its tag, Prompt.zig).
+ startPrompt(p, pane, &pane.body, .save);
p.update(.{ .key = .{ .cp = 't', .text = "tw" } });
p.update(.{ .key = .{ .cp = Key.left } });
- try std.testing.expect(pane.prompt == .search and pane.focus == .body);
- try std.testing.expectEqualStrings(config.select_marker ++ "tw", pane.promptText().?);
+ try std.testing.expect(pane.prompt == .save and pane.focus == .body);
+ try std.testing.expectEqualStrings(config.save_marker ++ "/tw", pane.promptText().?);
_ = frame.reset(.retain_capacity);
_ = try p.render(frame.allocator());
// The tagline is exactly what it was: nothing of the prompt is in it.
@@ -1939,8 +1944,8 @@ test "a prompt is typed on its own line in the notice band and leaves the tag ro
const grid = p.surface.cursor orelse return error.MissingPromptCursor;
try std.testing.expectEqual(p.bodyTop(pane, p.view().rects[0]), grid.y);
- // Submitting searches for what was typed and gives the prompt its line back.
- p.update(.{ .key = .{ .cp = Key.enter } });
+ // Esc gives the prompt its line back.
+ p.update(.{ .key = .{ .cp = Key.escape } });
try std.testing.expect(pane.prompt == .none and pane.input.own == null);
}