Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/layout/Picker.zig
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub fn draw(self: *Picker, f: *Layout) void {
const ranked_all = offered(f, &region, &query);
// Each card under the place holding it, or else the place its keywords make it for; this one
// first, so what belongs in the explorer and what in the panel reads off the headers. A
// query ranks within each. Sorted once, not per section.
// query ranks within each. Each card's section is worked out once, not once per section.
const sections = f.arena.alloc(usize, ranked_all.len) catch return;
for (ranked_all, sections) |ranked, *section| {
const s = &f.host.surfaces.items[ranked.item];
Expand Down Expand Up @@ -461,6 +461,9 @@ test "a view a place holds is listed under that place, whatever its keywords" {
/// The place being edited, when no card falls under it: its header still leads, so the popup
/// says which place it fills — a split's new leaf accepts no view's keywords until one is put in.
fn emptyHome(region: *const Layout.Region, query: *const core.fuzzy.Query) void {
var box = dvui.box(@src(), .{ .dir = .vertical }, .{ .expand = .horizontal });
defer box.deinit();
core.anchor.mark(box.data(), "picker.empty", .{});
sectionHeader(region.name, 0);
dvui.labelNoFmt(@src(), if (query.isEmpty()) "Nothing here yet." else "No matching views here.", .{}, .{
.padding = .{ .x = 4, .h = 4 },
Expand Down
3 changes: 3 additions & 0 deletions tests/integration.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2520,10 +2520,13 @@ test "the picker lists each view under the place it is made for, the open place
for (0..4) |_| _ = try dvui.testing.step(PickerFrame.frame);
try std.testing.expectEqual(try y("test.output"), try y("test.files"));
try std.testing.expect(try y("test.output") < try y("test.misc"));
// The sidebar holds nothing now, and still leads, empty, under its own name.
try std.testing.expect((try dvui.testing.tagGet("picker.empty")).rect.y < try y("test.files"));
editor.app.layout.openPicker(editor.app.gpa, "Panel", null);
for (0..4) |_| _ = try dvui.testing.step(PickerFrame.frame);
try std.testing.expectEqual(try y("test.output"), try y("test.files"));
try std.testing.expect(try y("test.output") < try y("test.misc"));
try std.testing.expect(dvui.tagGet("picker.empty") == null);
}

test "a hide_when_empty panel stays while its view is dragged onto main" {
Expand Down
Loading