Expose file and Pi panels

This commit is contained in:
slhx agent
2026-06-21 21:26:51 +02:00
parent 062d0f1af9
commit 9ef2f97423
4 changed files with 47 additions and 4 deletions
+22
View File
@@ -1313,6 +1313,15 @@ pub const Client = struct {
self.panel_context = .file_picker;
}
fn openPiPanel(self: *Client) !void {
const rows = [_][]const u8{
"pi_ask:explain_current_buffer",
"pi_edit:propose_patch",
"pi_review:critique_diff",
};
try self.openListRows("pi", rows[0..], .none);
}
fn openListRows(self: *Client, title: []const u8, rows: []const []const u8, context: PanelContext) !void {
if (rows.len == 0) {
self.message = "empty list";
@@ -2426,6 +2435,7 @@ pub const Client = struct {
},
.symbol => |symbol| try self.applyProtocol(symbol_mod.protocolCommand(symbol)),
.file_picker => try self.openFilePickerPanel(),
.pi_panel => try self.openPiPanel(),
.search_file => self.openSearchPrompt(),
.search_project => self.openProjectSearchPrompt(),
.hover => try self.showCompactHover(),
@@ -5353,3 +5363,15 @@ test "regular: dot repeats put and remains undoable" {
snap = try client.session.snapshot();
try std.testing.expectEqualStrings("abcabc", snap.bytes);
}
test "regular: Space P opens Pi panel" {
var client = try Client.init(std.testing.allocator, .{ .width = 56, .height = 10 });
defer client.deinit();
try client.handleInput(" ");
try client.handleInput("P");
const frame = try client.render(std.testing.allocator);
defer std.testing.allocator.free(frame);
try std.testing.expect(std.mem.indexOf(u8, frame, "panel [pi]") != null);
try std.testing.expect(std.mem.indexOf(u8, frame, "pi_ask:explain_current_buffer") != null);
}