summaryrefslogtreecommitdiff
path: root/core/Pick.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 05:03:22 -0300
committerGabriel Schneider <[email protected]>2026-11-25 05:10:14 -0300
commit7611e1bb7a1c3eda2f4ac463881f543653abd035 (patch)
treeb0ea5bb10dceaf3db2db7f9b06e7641f3e09ea57 /core/Pick.zig
parent36e5561ed6135e2c66f1e0813b037f34a1249eda (diff)
downloadpardes-7611e1bb7a1c3eda2f4ac463881f543653abd035.tar.gz
pardes-7611e1bb7a1c3eda2f4ac463881f543653abd035.zip
lsp_client, Ask, Pick, body_layer: code actions as a picker (walk UI P3 item 1, SPEC §5.1 "actions", §14.1, POLISH 17): the client sent each action's title alone (lsp_client run `.code_action`), so `SPC l a` could only list them in a +Lsp, nothing to preview or apply; NOW the client writes each action's row and after it its edit of this file as `@put` records (actionEdits, sorted, sharing renameEdits' WorkspaceEdit reading as editFiles), `@elsewhere` for an edit that reaches another file or makes one (never a part of it applied), none for a command's; an action the server sent without its edit but with `data` is asked for it with codeAction/resolve when the server says resolveProvider (Caps.resolve_actions); typed where jumps walk (Ask's `ghost`, recorded at ask time as the hover's) the answer is Pick's new source `actions` in the asking pane's own tag (`␣ l a Actions`, its host the edited pane as the themes picker's), each row its digit in the key ink then the title (the query matches the title), the body moved to the edit's first line while it is under the cursor and showing its edit as ghost rows (Pick.ghosts, drawn after Prompt.ghosts by the body layer: the lines it changes on the Changes layer's deleted ground, what they become after them on the added ground, the rows below pushed down; R3, DESIGN D4 add/del; bounded by the rows shown), Enter or `1`-`9` with the field empty applies it as one undo step through Ask.applyAction (applyLspEdits, of the revision it was asked of: Pick.revision), the tag at rest first; a command's or an elsewhere edit is said, not applied; anyone else's (a 9P script) keeps the +Lsp of titles; the mock (test/lspmock.zig) answers three actions: a title alone, one with its edit (a line put in at the top), one resolved (main.rs's two `add` calls to `sum`); CodeAction's doc and the builtins json say so; TESTS: core/Pick.zig "code actions: a picker in the asking pane's tag ..." (ghost rows and grounds rendered, `3` applies, `u` undoes, a command's said), test/behaviour/language_servers.zig "SPC l a lists the server's code actions in the pane's tag by their digits ..." (through the mock end to end, resolve included; on the base `SPC l a` makes a +Lsp); core-test 1063/1233 (170 skipped), behaviour-test 279/279, shell-test's edit tests 89/89
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.zig264
1 files changed, 245 insertions, 19 deletions
diff --git a/core/Pick.zig b/core/Pick.zig
index e19866d3..6d2c9ba1 100644
--- a/core/Pick.zig
+++ b/core/Pick.zig
@@ -35,6 +35,10 @@ const Stream = @import("Stream.zig");
const Trail = @import("Trail.zig");
const TagState = @import("TagState.zig");
const Band = @import("Band.zig");
+const Places = @import("Places.zig");
+const colors = @import("colors.zig");
+const Surface = @import("surface.zig").Surface;
+const Cell = @import("surface.zig").Cell;
const Query = panes.Query;
const File = panes.File;
const Output = panes.Output;
@@ -48,9 +52,10 @@ const Key = pardes.Key;
/// declarations, the lines holding the query in every open pane (All, its
/// places in each), the jump list, rows handed over (a language server's
/// answer, SPC e's places), titled by their word, the messages' history
-/// (SPC h m), and the themes (SPC t t, the window wearing the one under
-/// the cursor).
-pub const Source = enum { find, grep, recent, panes, symbols, all, jumplist, list, messages, themes };
+/// (SPC h m), the themes (SPC t t, the window wearing the one under
+/// the cursor), and a language server's code actions for the caret's place
+/// (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`).
@@ -65,6 +70,7 @@ const words = std.EnumArray(Source, struct { word: []const u8, keys: []const u8
.list = .{ .word = "List", .keys = "l" },
.messages = .{ .word = "Messages", .keys = "hm" },
.themes = .{ .word = "Themes", .keys = "t" },
+ .actions = .{ .word = "Actions", .keys = "la" },
});
/// The pickers kept after they roll up, for their list words and Resume.
@@ -94,8 +100,11 @@ names: Names = .{},
/// A Grep's lines, as the disk engine sends them (Query.take).
found: std.ArrayList(Query.Found) = .empty,
found_bytes: std.ArrayList(u8) = .empty,
-/// A list's rows, as they were handed over (`path:line:col text`).
+/// A list's rows, as they were handed over (`path:line:col text`); code
+/// actions' each followed by its edit's records (lsp_client actionEdits).
rows: []u8 = &.{},
+/// The revision of the asking text its actions' edits are of.
+revision: u32 = 0,
/// The query and the cursor as it rolled up (live, they are its view's
/// field and cursor).
query: Kind.Buf(256) = .{},
@@ -225,8 +234,8 @@ fn hostIn(p: *Pardes, pk: *Pick, from: usize) !void {
pk.owner = asker.serial;
pk.made = false;
// A theme is no place: its list is the asking pane's own tag (§3.5),
- // and its preview the whole window.
- if (pk.source == .themes) {
+ // and its preview the whole window; an action's is that text's edit.
+ if (pk.source == .themes or pk.source == .actions) {
pk.landing = asker.serial;
p.view().active = from;
return;
@@ -303,6 +312,21 @@ fn start(p: *Pardes, pk: *Pick) void {
.themes => for (pardes.colors.themes, 0..) |t, i| {
pk.names.add(p.gpa, t.name, 0, t.name.len, 0, @intCast(i)) catch return;
},
+ // Each action by its title, its digit before it (the first nine,
+ // which `1`-`9` apply), the title what the query matches.
+ .actions => {
+ var lines = std.mem.splitScalar(u8, pk.rows, '\n');
+ var i: u32 = 0;
+ while (lines.next()) |ln| {
+ if (ln.len == 0 or ln[0] == '@') continue;
+ const title = std.mem.trimStart(u8, ln[Output.location(ln).end..], " ");
+ var buf: [2 + 512]u8 = undefined;
+ const cut = title[0..@min(title.len, 512)];
+ const text = if (i < 9) std.fmt.bufPrint(&buf, "{d} {s}", .{ i + 1, cut }) catch unreachable else cut; // 2 + 512 fit
+ pk.names.add(p.gpa, text, text.len - cut.len, cut.len, 0, i) catch return;
+ i += 1;
+ }
+ },
}
}
@@ -401,7 +425,7 @@ pub fn produceAll(p: *Pardes, tick: bool) void {
for (p.picks) |slot| if (slot) |pk| if (pk.unrolled) {
if (pk.names.busy()) pk.names.rescore(p.gpa);
// A theme's preview in the step of the key that moved to it.
- if (pk.source == .themes) pardes.colors.previewTheme(p, themeAt(p, pk));
+ if (pk.source == .themes) pardes.colors.previewTheme(p, refAt(p, pk));
if (tick) preview(p, pk);
};
}
@@ -416,8 +440,9 @@ pub fn busy(p: *const Pardes) bool {
// ---- the rows ----
-/// The theme the cursor of a themes picker is on.
-fn themeAt(p: *const Pardes, pk: *const Pick) ?usize {
+/// What the row under the cursor is of: a themes picker's theme, an
+/// actions picker's action.
+fn refAt(p: *const Pardes, pk: *const Pick) ?usize {
const n = pk.names.hits.items.len;
if (n == 0) return null;
const at = @min(p.view().tag_state.rows.at, n - 1);
@@ -459,7 +484,7 @@ const Target = union(enum) { none, place: struct { path: []const u8, at: look.Sp
/// Row `i` as the band shows it and what it points at, its text in
/// `arena`.
-const Row = struct { text: []const u8, pre: u16 = 0, faint: u16 = 0, dim: bool = false, marks: []const u16 = &.{}, target: Target = .none };
+const Row = struct { text: []const u8, key: u8 = 0, pre: u16 = 0, faint: u16 = 0, dim: bool = false, marks: []const u16 = &.{}, target: Target = .none };
fn rowAt(p: *Pardes, pk: *const Pick, arena: std.mem.Allocator, i: usize) !Row {
const dir = pk.dir.slice();
@@ -528,6 +553,19 @@ fn rowAt(p: *Pardes, pk: *const Pick, arena: std.mem.Allocator, i: usize) !Row {
row.target = .{ .place = .{ .path = f.path, .at = .{ .line = cand.ref } } };
},
.themes => {},
+ // An action: its digit a key; its place the first line its edit
+ // changes, which the body is moved to while it is previewed.
+ .actions => {
+ row.key = @intFromBool(cand.ref < 9);
+ const owner = p.panes[p.paneBySerial(pk.landing) orelse return row].?;
+ // With the `Changes` layer's lines shown the body stays where it is.
+ const f = if (owner.file) |*file| file else return row;
+ if (f.layer.lines.len > 0 or f.revision != pk.revision) return row;
+ const edits = pardes.lsp.Ask.parseLspEdits(arena, (action(pk, cand.ref) orelse return row).records, null) orelse return row;
+ if (edits[0].start > f.content.len) return row;
+ const line = @import("Places.zig").lineOf(try File.lineIndex(p.gpa, f), edits[0].start);
+ row.target = .{ .place = .{ .path = f.path, .at = .{ .line = line + 1 } } };
+ },
.recent, .jumplist, .list, .grep, .all => {
const t = look.parsePathLine(text);
row.pre = @intCast(t.end);
@@ -588,9 +626,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head {
try text.print(arena, " {d}/{d}", .{ if (n == 0) 0 else s.rows.at + 1, n });
if (pk.marks.items.len > 0) try text.print(arena, " •{d}", .{pk.marks.items.len});
if (pk.names.busy() or p.stream.busyFor(pk.id)) try text.appendSlice(arena, " ⋯");
- // Themes have no acts and no other sources: no second row.
- if (pk.source == .themes) {
- try text.appendSlice(arena, " ⏎ wear it · esc");
+ // Themes and actions have no acts and no other sources: no second row.
+ if (pk.source == .themes or pk.source == .actions) {
+ try text.appendSlice(arena, if (pk.source == .themes) " ⏎ wear it · esc" else " ⏎ or 1-9 apply it · esc");
for (cells[0..ncells]) |c| try spans.append(arena, .{ .lo = c[0], .hi = c[1], .style = .key });
return .{ .text = text.items, .spans = spans.items, .cells = @intCast(ncells), .caret = caret };
}
@@ -613,7 +651,7 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head {
for (acts) |act| if (offered(pk, act)) try text.print(arena, "{s} ", .{act.word});
try text.appendSlice(arena, "|");
var first = false;
- inline for (comptime std.enums.values(Source)) |src| if (src != .list and src != .messages and src != .themes) {
+ inline for (comptime std.enums.values(Source)) |src| if (src != .list and src != .messages and src != .themes and src != .actions) {
if (src != pk.source) {
if (!first) try text.append(arena, ' ');
first = false;
@@ -665,7 +703,7 @@ pub fn steps(p: *Pardes, arena: std.mem.Allocator) ![]Band.Step {
const rows = try arena.alloc(Band.Row, w.hi - w.lo);
for (rows, w.lo..) |*row, i| {
const r = try rowAt(p, pk, arena, i);
- row.* = .{ .text = r.text, .on = i == s.rows.at, .mark = marked(pk, idOf(pk, i)) != null, .dim = r.dim, .pre = r.pre, .faint = r.faint, .marks = r.marks, .index = @intCast(i) };
+ row.* = .{ .text = r.text, .key = r.key, .on = i == s.rows.at, .mark = marked(pk, idOf(pk, i)) != null, .dim = r.dim, .pre = r.pre, .faint = r.faint, .marks = r.marks, .index = @intCast(i) };
}
out[0] = .{ .rows = rows };
return out;
@@ -823,6 +861,128 @@ pub fn deinitAll(p: *Pardes) void {
};
}
+// ---- code actions ----
+
+/// Action `index` of a code actions picker's rows: its title and its edit's
+/// records (the `@put` lines after its row, `@elsewhere` for an edit that
+/// reaches other files, none for a command's); null past the last.
+fn action(pk: *const Pick, index: usize) ?struct { title: []const u8, records: []const u8 } {
+ var lines = std.mem.splitScalar(u8, pk.rows, '\n');
+ var n: usize = 0;
+ while (lines.next()) |ln| {
+ if (ln.len == 0 or ln[0] == '@') continue;
+ if (n < index) {
+ n += 1;
+ continue;
+ }
+ const from = lines.index orelse pk.rows.len;
+ var to = from;
+ while (lines.peek()) |next| {
+ if (next.len == 0 or next[0] != '@') break;
+ _ = lines.next();
+ to = lines.index orelse pk.rows.len;
+ }
+ return .{ .title = std.mem.trimStart(u8, ln[Output.location(ln).end..], " "), .records = pk.rows[from..to] };
+ }
+ return null;
+}
+
+/// Action `index` of the live actions picker applied to the text it was
+/// asked of as one undo step, the tag put to rest first (its caret back
+/// where it was, then moved with the edit); one with no edit here (a
+/// command's, or one reaching other files) said and not applied.
+fn apply(p: *Pardes, pk: *Pick, index: usize) void {
+ const act = action(pk, index) orelse return;
+ const id = p.paneBySerial(pk.landing) orelse return TagState.toRest(p);
+ TagState.toRest(p);
+ var said: Kind.Buf(256) = .{};
+ if (std.mem.eql(u8, act.records, "@elsewhere\n")) return p.reportFailure(id, said.print("Actions: {s}: its edit reaches other files, not applied", .{act.title}));
+ if (act.records.len == 0) return p.reportFailure(id, said.print("Actions: {s}: no edit to apply", .{act.title}));
+ if (!pardes.lsp.Ask.applyAction(p, p.panes[id].?, pk.revision, act.records)) return p.reportFailure(id, said.print("Actions: {s}: not applied, the text is not what it was asked of", .{act.title}));
+ p.setMessage(.at(id), said.print("Actions: {s}", .{act.title}));
+}
+
+/// The live code actions picker's preview in its body (SPEC §5.1, the
+/// coordinator's R3): the edit of the action under the cursor, the lines it
+/// changes on the deleted ground and what they become after them as ghost
+/// rows on the added ground, the rows below pushed down and the last off
+/// the view. Drawn, never written; the rows shown alone.
+pub fn ghosts(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: pardes.Rect, body_h: u16) !void {
+ const pk = live(p) orelse return;
+ if (pk.source != .actions or !pk.previews or pk.landing != pane.serial) return;
+ const f = if (pane.file) |*file| file else return;
+ if (f.revision != pk.revision) return;
+ const records = (action(pk, refAt(p, pk) orelse return) orelse return).records;
+ const edits = pardes.lsp.Ask.parseLspEdits(arena, records, null) orelse return;
+ const text = f.content;
+ const index = try File.lineIndex(p.gpa, f);
+ // The edits by the lines they touch: each run of them its old lines
+ // [lo, hi) and their new text, which goes before line hi.
+ const Group = struct { lo: usize, hi: usize, new: []const u8 };
+ var groups: std.ArrayList(Group) = .empty;
+ var k: usize = 0;
+ while (k < edits.len) {
+ const begin = File.bufferOffset(f, edits[k].start, false);
+ if (begin > text.len) return;
+ const lo = Places.lineOf(index, begin);
+ var new: std.ArrayList(u8) = .empty;
+ try new.appendSlice(arena, text[index[lo]..begin]);
+ var hi = lo;
+ var at = begin;
+ while (k < edits.len) : (k += 1) {
+ const from = File.bufferOffset(f, edits[k].start, false);
+ const to = File.bufferOffset(f, edits[k].end, edits[k].end > edits[k].start);
+ if (from < at or to < from or to > text.len) return;
+ if (from > begin and Places.lineOf(index, from) >= hi) break;
+ try new.appendSlice(arena, text[at..from]);
+ try new.appendSlice(arena, edits[k].text);
+ at = to;
+ const line = Places.lineOf(index, to);
+ // Up to a line's start, from one or past its own text: that
+ // line is not changed.
+ hi = if (to == index[line] and (to > begin or begin == index[lo])) line else line + 1;
+ }
+ try new.appendSlice(arena, text[at..if (hi < index.len) index[hi] else text.len]);
+ try groups.append(arena, .{ .lo = lo, .hi = hi, .new = new.items });
+ }
+ const tab = p.settings.tab;
+ const y0 = p.bodyTop(pane, r);
+ const rows: usize = @min(body_h, s.rows -| y0);
+ const first: usize = pane.context_rows;
+ if (rows <= first) return;
+ const w: usize = s.cols;
+ const old = try arena.dupe(Cell, s.cells[(y0 + first) * w .. (y0 + rows) * w]);
+ const grounds = colors.Grounds.of(p.theme());
+ const ink = p.theme().fg orelse p.theme().tag_fg;
+ const x0 = r.x + config.GUTTER + File.gutterWidth(pane);
+ const width = r.w -| (x0 - r.x);
+ var out: usize = first;
+ var g: usize = 0;
+ var vr: usize = first;
+ while (vr < rows and out < rows) : (vr += 1) {
+ const shown = pane.wrapAt(tab, @intCast(vr)).line;
+ const line: usize = if (shown < 0) index.len else @intCast(shown);
+ if (vr == first or pane.wrapAt(tab, @intCast(vr - 1)).line != shown) {
+ while (g < groups.items.len and groups.items[g].hi < line) g += 1;
+ while (g < groups.items.len and groups.items[g].hi == line) : (g += 1) {
+ var news = std.mem.splitScalar(u8, std.mem.trimEnd(u8, groups.items[g].new, "\n"), '\n');
+ if (groups.items[g].new.len > 0) while (news.next()) |l| {
+ if (out >= rows) break;
+ const y: u16 = @intCast(y0 + out);
+ s.fill(0, y, @intCast(s.cols), 1, .{});
+ s.fill(x0, y, width, 1, .{ .bg = .{ .rgb = grounds.add.row } });
+ _ = s.print(x0, y, width, l, .{ .fg = .{ .rgb = ink }, .bg = .{ .rgb = grounds.add.row } });
+ out += 1;
+ };
+ }
+ }
+ if (out >= rows) break;
+ @memcpy(s.cells[(y0 + out) * w ..][0..w], old[(vr - first) * w ..][0..w]);
+ if (g < groups.items.len and line >= groups.items[g].lo and line < groups.items[g].hi) s.tint(x0, @intCast(y0 + out), width, grounds.del.row, null);
+ out += 1;
+ }
+}
+
// ---- keys ----
/// A key in the live picker (keys.zig tagStateKey, SPEC §5.4). Esc is
@@ -840,14 +1000,18 @@ pub fn key(p: *Pardes, k: Key) void {
return;
}
if (pk.spine == .acts) return actKey(p, pk, k);
- // Themes: Enter wears the one under the cursor; the rows and the field.
- if (pk.source == .themes) {
- if (plain and k.cp == Key.enter) {
- const at = themeAt(p, pk) orelse return;
+ // Themes: Enter wears the one under the cursor; actions: Enter, or an
+ // action's digit with the field empty, applies it; the rows and the
+ // field.
+ if (pk.source == .themes or pk.source == .actions) {
+ if (plain and k.cp == Key.enter and pk.source == .themes) {
+ const at = refAt(p, pk) orelse return;
TagState.toRest(p);
pardes.colors.setThemeIndex(p, at);
return;
}
+ if (plain and k.cp == Key.enter) return apply(p, pk, refAt(p, pk) orelse return);
+ if (pk.source == .actions and plain and s.field.len == 0 and k.cp >= '1' and k.cp <= '9') return apply(p, pk, k.cp - '1');
if (s.rows.key(k, n)) return;
if (s.field.key(k)) filter(p, pk);
return;
@@ -1926,3 +2090,65 @@ test "n and N walk the newest list or search word, or the one Looked at (SPEC §
p.update(.{ .key = .{ .cp = 'n', .text = "n" } });
try std.testing.expect(pane.places.current != null and !std.meta.eql(was, pane.places.current));
}
+
+test "code actions: a picker in the asking pane's tag, the one under the cursor its edit in the body (the lines it changes on the deleted ground, what they become after them), Enter or its digit applies it as one undo step, a command's said" {
+ const Key_ = pardes.Key;
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
+ defer p.deinit();
+ var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer frame.deinit();
+ p.settings.jumps = .walk;
+ const pane = try p.setTestFile("one\ntwo add\nthree\n");
+ const id = p.view().active;
+ // `add` is bytes 8..11.
+ const rows = "x:1:1 extract\nx:1:1 add a line\n@put 0 0 //%20top%0A\nx:1:1 rename add to sum\n@put 8 11 sum\n";
+ open(p, id, .actions, "", "", rows);
+ live(p).?.revision = pane.file.?.revision;
+ const s = &p.view().tag_state;
+ try std.testing.expectEqual(Source.actions, live(p).?.source);
+ try std.testing.expectEqual(pane.serial, s.host);
+ try std.testing.expectEqual(@as(usize, 3), count(p, live(p).?));
+ // The rename: `two add` on the deleted ground, `two sum` after it.
+ p.update(.{ .key = .{ .cp = Key_.down } });
+ p.update(.{ .key = .{ .cp = Key_.down } });
+ settle(p);
+ p.sync();
+ var shot = try p.render(frame.allocator());
+ const r = p.view().rects[id];
+ const x = r.x + config.GUTTER + File.gutterWidth(pane);
+ const y = p.bodyTop(pane, r);
+ const grounds = colors.Grounds.of(p.theme());
+ for ([_][]const u8{ "o", "t", "t", "t" }, [_][]const u8{ "n", "w", "w", "h" }, 0..) |c0, c1, row| {
+ try std.testing.expectEqualStrings(c0, shot.at(x, y + @as(u16, @intCast(row))).grapheme());
+ try std.testing.expectEqualStrings(c1, shot.at(x + 1, y + @as(u16, @intCast(row))).grapheme());
+ }
+ try std.testing.expectEqualStrings("a", shot.at(x + 4, y + 1).grapheme());
+ try std.testing.expectEqualStrings("s", shot.at(x + 4, y + 2).grapheme());
+ try std.testing.expectEqual(pardes.Color{ .rgb = grounds.del.row }, shot.at(x, y + 1).style.bg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = grounds.add.row }, shot.at(x, y + 2).style.bg);
+ try std.testing.expectEqualStrings("one\ntwo add\nthree\n", pane.file.?.content);
+ // Up: the line put in at the top, before line 1, nothing deleted.
+ p.update(.{ .key = .{ .cp = Key_.up } });
+ settle(p);
+ p.sync();
+ frame.deinit();
+ frame = std.heap.ArenaAllocator.init(std.testing.allocator);
+ shot = try p.render(frame.allocator());
+ try std.testing.expectEqualStrings("/", shot.at(x, y).grapheme());
+ try std.testing.expectEqual(pardes.Color{ .rgb = grounds.add.row }, shot.at(x, y).style.bg);
+ try std.testing.expectEqualStrings("o", shot.at(x, y + 1).grapheme());
+ try std.testing.expect(!std.meta.eql(pardes.Color{ .rgb = grounds.del.row }, shot.at(x, y + 1).style.bg));
+ // `3`: the rename applied, the tag at rest; one undo takes it back.
+ p.update(.{ .key = .{ .cp = '3', .text = "3" } });
+ try std.testing.expectEqual(TagState.Kind.rest, s.kind);
+ try std.testing.expectEqualStrings("one\ntwo sum\nthree\n", pane.file.?.content);
+ p.update(.{ .key = .{ .cp = 'u', .text = "u" } });
+ try std.testing.expectEqualStrings("one\ntwo add\nthree\n", pane.file.?.content);
+ // Enter on a command's: said, nothing changed.
+ open(p, id, .actions, "", "", rows);
+ live(p).?.revision = pane.file.?.revision;
+ p.update(.{ .key = .{ .cp = Key_.enter } });
+ try std.testing.expectEqual(TagState.Kind.rest, s.kind);
+ try std.testing.expectEqualStrings("one\ntwo add\nthree\n", pane.file.?.content);
+ try std.testing.expectEqualStrings("Actions: extract: no edit to apply", p.messages.saidBy(pane));
+}