summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 20:33:01 -0300
committerGabriel Schneider <[email protected]>2026-11-24 20:33:01 -0300
commitabe3817e8dd0af41e6b5786bdbeb631219b58c23 (patch)
treed2db2ba07f1b8ee743926aa87b8c25070f72fcb6 /core/panes.zig
parent480f36b85299fa7407c20a2d6482dd093f842bf7 (diff)
downloadpardes-abe3817e8dd0af41e6b5786bdbeb631219b58c23.tar.gz
pardes-abe3817e8dd0af41e6b5786bdbeb631219b58c23.zip
Prompt: a body's text prompts ask in its tag's head (walk UI, pick-ui SPEC.md §7.1, §7.2, item 1 of line E): `s S K A-K | A-| ! A-! $` from a body are a typing state of the view's tag (TagState.Kind.prompt, its state Prompt.zig, its field A's Field), drawn after the prefix in place of the tag's own text (R1): box `^`, the prompt's key cell, the field, the plain word it stands for (`= Exec Edit x/self/`, `Edit g/re/`, `Edit |tr a-z A-Z`, `Edit >cmd`; none for `! A-! $`), its count (`2 selections in 3 lines`, `keeps 1 of 2`, `0` for no match, the selections it began with back), the hints; the live machinery as it was (normal.applySelRegex, now returning what it found; the pipe off the loop, Pipe.submit split from the notice band's submitPipe); a pattern that is no regex changes nothing, the last result drawn dimmed (body_layer) and the reason at the count's place in the error ink (TagState.Style.err, regexp's message); Up/Down recall the history inline, Ctrl-r unrolls it as a band step filtered by the field (three session histories, Pardes.prompt_history: search and select's, the pipes', the command line's, 16 lines each, in the digest and the dump); Esc and Backspace on an empty field put the body back; Enter keeps the line in its history and the pattern in `/`, the command in `|`; a paste goes into the field; a prompt for a tag's or a header's text, Save's path, a terminal's `/` still ask on the notice band; wire 37; TEST FIRST: Prompt.zig "s asks in the tag's head ..." and "Enter keeps what s found ... a pipe from the body asks in the tag and runs off the loop"; Pipe.zig's and panes.zig's prompt tests and test/behaviour/keys.zig's two read the head; goldens pipe, selregex, msg (the prompt in the tag head, no chip); core-test 1014/1180 (166 skipped), shell-test 1227/1230, pane-test 182/184 (the 1 failure A's: `SPC h ?` is Help in the tag now), behaviour-test 274/277 (the 3 failures A's: window mode's head, a struck leader key), process-test the 6 of A's report plus none of mine, term-test 17/17, kitty-test 45/45
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/panes.zig b/core/panes.zig
index 115323c4..0590a80d 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -1953,7 +1953,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");
@@ -1963,13 +1963,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.
@@ -1986,7 +1986,7 @@ 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);
}