summaryrefslogtreecommitdiff
path: root/core/Pick.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 14:56:11 -0300
committerGabriel Schneider <[email protected]>2026-11-25 15:00:10 -0300
commit98872935ca6ea4e602fd5bfc3948f9bbe77a3ba3 (patch)
tree3270eda78534bc6caf3512cc269b3e39b6676e7a /core/Pick.zig
parentc6dc2a6148855e0f02e86103dd80f47525a985e4 (diff)
parented518c211808ebee46f934320569d86121a8a739 (diff)
downloadpardes-98872935ca6ea4e602fd5bfc3948f9bbe77a3ba3.tar.gz
pardes-98872935ca6ea4e602fd5bfc3948f9bbe77a3ba3.zip
walk UI M11: Z1's three changes (nqultymy TagState.loaded holds a loaded tag state to what its own state reads, the dump fuzz seeding describe-key's state too; rllrtrxu R's two nits; xxmkroru ed518c211808 a Messages picker's keys are SPC h's, so Backspace on its empty field no longer kills the session) merged onto M10 (lkswuzxk), resolved by meaning: two text conflicts, both the tests the two lines put at the end of the same file (core/Pick.zig: F1's "a picker previews the row under its cursor from the frame its rows come ..." and Z1's "Backspace on a Messages picker's empty field ..."; core/TagState.zig: F1's "a rolled level that wraps has its hints on its last row ..." and Z1's two load tests), each kept whole, F1's first; the rest sits apart (F1's TagState.head and Pick.preview against Z1's TagState.loaded and Pick.words; F1 adds no field to a dump, so loaded's checks read the same state); the tree after the merge is M10's with exactly Z1's diff from M9 (5 files, +274 -20); core-test 1105/1276 (171 skipped: M10's 1102 + Z1's three), load 3 to 5
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Pick.zig')
-rw-r--r--core/Pick.zig25
1 files changed, 22 insertions, 3 deletions
diff --git a/core/Pick.zig b/core/Pick.zig
index 3e326bb4..b76020ca 100644
--- a/core/Pick.zig
+++ b/core/Pick.zig
@@ -57,8 +57,9 @@ const Key = pardes.Key;
/// (SPC l a, the body showing the one under the cursor as its edit).
pub const Source = enum { find, grep, recent, panes, symbols, all, jumplist, list, messages, themes, actions };
-/// Each source's word in the tag and the leader keys of the builtin that
-/// opens it, its key cells (`␣ f Find`).
+/// Each source's word in the tag and its key cells (`␣ f Find`); a
+/// source whose Backspace leaves it (`back`) goes back to the SPC level of
+/// those keys: a group's.
const words = std.EnumArray(Source, struct { word: []const u8, keys: []const u8 }).init(.{
.find = .{ .word = "Find", .keys = "f" },
.grep = .{ .word = "Grep", .keys = "f" },
@@ -68,7 +69,7 @@ const words = std.EnumArray(Source, struct { word: []const u8, keys: []const u8
.all = .{ .word = "All", .keys = "" },
.jumplist = .{ .word = "Jumplist", .keys = "j" },
.list = .{ .word = "List", .keys = "l" },
- .messages = .{ .word = "Messages", .keys = "hm" },
+ .messages = .{ .word = "Messages", .keys = "h" },
.themes = .{ .word = "Themes", .keys = "t" },
.actions = .{ .word = "Actions", .keys = "la" },
});
@@ -2601,3 +2602,21 @@ test "a picker previews the row under its cursor from the frame its rows come, w
try std.testing.expectEqualStrings(a_path, p.panes[greader].?.file.?.path);
try std.testing.expectEqual(@as(?usize, 1), landingLine(p, frame.allocator(), p.panes[greader].?));
}
+
+test "Backspace on a Messages picker's empty field goes back to the level it was run from, SPC h, unrolled and drawn: its keys are its level's, as every other picker's are" {
+ const Key_ = pardes.Key;
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 });
+ defer p.deinit();
+ var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer frame.deinit();
+ _ = try p.setTestFile("one\ntwo\n");
+ for (" hm") |c| p.update(.{ .key = .{ .cp = c } });
+ try std.testing.expectEqual(Source.messages, live(p).?.source);
+ p.sync();
+ _ = try p.render(frame.allocator());
+ p.update(.{ .key = .{ .cp = Key_.backspace } });
+ try std.testing.expect(p.view().prefix == .leader and p.view().tag_state.unrolled);
+ try std.testing.expectEqualStrings("h", p.view().leader_keys[0..p.view().leader_n]);
+ p.sync();
+ _ = try p.render(frame.allocator());
+}