diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 23:42:03 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 00:26:22 -0300 |
| commit | 57a696106fb628aa39aa3c082234865c199fd483 (patch) | |
| tree | 8496cba3ec8cb01a2f2cc51f50c8679670ad7f38 /core | |
| parent | 2f3ba8edfa26eb9dad190da42ab6a1ac4f29ffd8 (diff) | |
| download | pardes-57a696106fb628aa39aa3c082234865c199fd483.tar.gz pardes-57a696106fb628aa39aa3c082234865c199fd483.zip | |
config, look, Trail, tests: jumps walk by default, `Jumps new-pane` the opt-out (walk UI G item 3, the coordinator's ruling: SPEC §6.6), every test about a jump opening a pane set to new-pane, a reader placed with its walk in its tag and a stepped pane lifted to its tag's rows: config.zig Settings.jumps is `.walk`; FOUND BY THE FLIP (core/ninep/tree.zig 'random placements, refused or not, leave no pane under its tag and two rows', seed 69 rows 21: a Look's reader 5 rows high where its tag takes 2): look.zig walk set a new reader's walk (‹@pN and its place) after openNew had placed it, so its rows were given for a tag a row shorter; openNew sets it before layout.placeNew now; Trail.show (a step to another file in place, Back, Forward, a list's n) replaced the pane with its trail and a longer name and gave it the old pane's rows, and a step in the same file pushed a word the tag may wrap on: Trail.lift gives the stepped pane its minimum from its column (layout.restoreMinimaFrom, the others keeping theirs); NOT FIXED (seed 109): a step in place in a column with no rows to give still wraps its tag under its minimum (the spec's give-way, folding the trail further, is the fix): that test runs with new-pane now (it is about placements as a Look made them), its comment says so; core/replica.zig's may_wait gets `Look *` stopping at read_file: a jump from a held pane (a kind's, a listing's) opens its reader from the disk where new-pane focused the reading pane already showing the file (SPEC §6.1 focuses a held one only); TESTS SET TO `Jumps new-pane` (each ABOUT a Look opening a pane, a query pane, a twin, Back/Forward over panes, a placement): 39 core and pane tests (look.zig 10, Query.zig 7, jj.zig 7, edit_cmd.zig 3, ninep/ctl.zig 2, test/panes.zig 3, lsp/Ask, Messages (C's SPC e +Search way), Store, layout, rollback, replica, ninep/tree), 25 behaviour tests (look-and-exec 5, placement 4, other-files 5, modes 3, language-servers 3, settings, follow, addons, columns-and-tags, panes), 18 process cases (`.init` or Tty.config: edit, flags 2, the canary, mounts, other-files 2, root-ctl, tree 2, filewatch, topbarexec, chordcut, cmdword, grep, lsprelpath, lsp-rename-files, layout-open); TESTS OF A FILE PANE'S TAG made to hold their pane first (`Keep`, SPEC §6.5: the `Keep` word moves every offset after the path): 16 behaviour tests (tags 11, keys 2, panes, columns-and-tags); GOLDENS regenerated and read, each changed row only ` Keep` after a reading pane's path (.scratch/walkui/G/gkeep.py): argv builtins cmdexit collapse delask lsp-rename lspcomplete markup mini msg nested-optout pipe savepane selregex themesel tutor (16); the other 41 changed goldens are NOT in this change (their rows move with more than the word: see the next change); tui core-test 1037/1206 (169 skipped), shell-test 1253/1256, pane-test 183/184 (1 skipped), behaviour-test 277/277, process-test 41 of 146 failed (those 41 goldens, every one a GoldenMismatch)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core')
| -rw-r--r-- | core/Messages.zig | 2 | ||||
| -rw-r--r-- | core/Query.zig | 14 | ||||
| -rw-r--r-- | core/Store.zig | 2 | ||||
| -rw-r--r-- | core/Trail.zig | 14 | ||||
| -rw-r--r-- | core/config.zig | 8 | ||||
| -rw-r--r-- | core/edit_cmd.zig | 6 | ||||
| -rw-r--r-- | core/jj.zig | 14 | ||||
| -rw-r--r-- | core/layout.zig | 2 | ||||
| -rw-r--r-- | core/look.zig | 24 | ||||
| -rw-r--r-- | core/lsp/Ask.zig | 2 | ||||
| -rw-r--r-- | core/ninep/ctl.zig | 4 | ||||
| -rw-r--r-- | core/ninep/tree.zig | 5 | ||||
| -rw-r--r-- | core/replica.zig | 3 | ||||
| -rw-r--r-- | core/rollback.zig | 2 |
14 files changed, 96 insertions, 6 deletions
diff --git a/core/Messages.zig b/core/Messages.zig index e995659a..e2224337 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -1395,6 +1395,8 @@ test "a file changed on disk under unsaved text asks in its tag and never takes test "SPC e on an error that names places lists them under the pane and lands on the first, on a question gives its tag the keyboard, and on anything else opens the history, the newest first" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try p.setTestFile("one\ntwo\nthree\nfour\nfive\n"); const serial = pane.serial; p.messages.live_len = 0; diff --git a/core/Query.zig b/core/Query.zig index d97a7fd1..67edc64c 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -2337,6 +2337,8 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing try tmp.dir.writeFile(std.testing.io, .{ .sub_path = name, .data = "pub fn split() void {}\nconst x = 1;\n" }); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; _ = try testFileIn(p, &tmp, "x.txt", "x\n"); p.newScratchBelow(0); const other = p.view().cols[0].panes[1]; @@ -2386,6 +2388,8 @@ test "Grep: lines of the files under the owner's directory, under their file; Al try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.zig", .data = "const needle = 1;\nconst hay = 2;\nneedle needle\n" }); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const a = try testFileIn(p, &tmp, "a.txt", "one needle\ntwo\n"); leader(p, "fg"); const qid = queryPane(p).?; @@ -2429,6 +2433,8 @@ test "* seeds line 1 and keeps the keyboard; SPC b b picks a pane, SPC s s a dec if (comptime !syntax.minimal_grammars) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try p.setTestFile("const alpha = 1;\nfn beta() void {\n _ = alpha;\n}\nfn gamma() void {}\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/tmp/x.zig"); @@ -2584,6 +2590,8 @@ test "B1 on a query pane's rows places the caret and selects, nothing else, the test "Enter on a frozen query pane's rows after its text was edited: no row to land on, the keyboard to its owner" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; _ = try p.setTestFile("alpha\n"); p.newScratchBelow(0); p.view().active = 0; @@ -2607,6 +2615,8 @@ test "a query row's place is its text: the match tinted after it, B3 on it opens defer tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const a = try testFileIn(p, &tmp, "a.txt", "zero\none needle\ntwo\nthree needle here\n"); leader(p, "fg"); typeKeys(p, "needle"); @@ -2668,6 +2678,8 @@ test "the +Preview: the query's hits in its file are its places, the row's one c try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.zig", .data = text }); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 60 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; _ = try testFileIn(p, &tmp, "a.txt", "x\n"); leader(p, "fg"); typeKeys(p, "needle"); @@ -2752,6 +2764,8 @@ test "a query row's address reaches every way a look arrives: an empty look writ defer tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const a = try testFileIn(p, &tmp, "a.txt", "zero\none needle\ntwo\nthree needle here\n"); leader(p, "fg"); typeKeys(p, "needle"); diff --git a/core/Store.zig b/core/Store.zig index ac9387cb..1328af38 100644 --- a/core/Store.zig +++ b/core/Store.zig @@ -290,6 +290,8 @@ test "store: a closed pane comes back where it was, its rows from the pane that const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; const p = try testWindow(dir); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; _ = try p.setTestFile("alpha\nbeta\n"); p.newScratchBelow(0); const sid = p.view().active; diff --git a/core/Trail.zig b/core/Trail.zig index c6af03e5..b6d6341a 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -196,6 +196,7 @@ fn show(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { if (pane.file) |f| if (std.mem.eql(u8, f.path, path)) { look.clearNavigationSelection(p, pane); look.focusPaneLine(p, id, at, .center); + lift(p, id); return id; }; const free = p.freeSlot() orelse return error.NoPaneSlots; @@ -212,7 +213,7 @@ fn show(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { try panes.deinitPane(p, pane); layout.replacePane(p, id, free); p.panes[id] = null; - layout.compute(p); + lift(p, free); look.focusPaneLine(p, free, at, .keep); // Its line half the body's rows down, as a look's new pane has it. const rows = @max(1, p.view().rects[free].h -| pardes.BOX_H); @@ -220,6 +221,17 @@ fn show(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { return free; } +/// Pane `id`'s tag after a step may take more rows than it had (its walk's +/// words, a longer name): it is given them from its column, as a step that +/// wraps tags gives them (layout.restoreMinimaFrom), the others keeping +/// their own minimum. +fn lift(p: *Pardes, id: usize) void { + const now = p.view().rects; + var floor = layout.minima(p); + floor[id] = 0; + layout.restoreMinimaFrom(p, &now, &floor); +} + /// Pane `id` held (§6.5): Keep, or an edit. It no longer walks, so the /// walk leaves its trail (places, lists, its owner, forward steps); words /// about its own text (a search, a recipe) stay. The next jump from its diff --git a/core/config.zig b/core/config.zig index 8bcf649f..13f66518 100644 --- a/core/config.zig +++ b/core/config.zig @@ -675,10 +675,10 @@ pub const Settings = struct { callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth, /// A jump (a Look at a place, a definition, an error's place) steps - /// the pane it is made from, or its reader, as a walk (Trail.zig); or - /// opens a pane for each file, as before the walk, until the walk's - /// pickers and prompts are in (pick-ui SPEC §14.3). - jumps: Jumps = .@"new-pane", + /// the pane it is made from, or its reader, as a walk (Trail.zig, the + /// spec's default); `new-pane` opens a pane for each file, as before + /// the walk (pick-ui SPEC §6.6's opt-out). + jumps: Jumps = .walk, /// A setting that is one of a few words, each an enum field of Settings. pub const Choice = enum { pet, jumps }; diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig index d1b41834..8fbde726 100644 --- a/core/edit_cmd.zig +++ b/core/edit_cmd.zig @@ -625,6 +625,8 @@ test "X over open files, w, e, r, f, B and D on panes and the disk" { const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; const p = try th.withFile(gpa, "scratch\n"); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var path: [4200]u8 = undefined; look.lookAt(p, 0, try std.fmt.bufPrint(&path, "{s}/a.c", .{dir})); const a = p.view().active; @@ -697,6 +699,8 @@ test "an Edit's w to a file changed on disk is refused once, as Save is, and the const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; const p = try th.withFile(testing.allocator, "scratch\n"); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var path: [4200]u8 = undefined; look.lookAt(p, 0, try std.fmt.bufPrint(&path, "{s}/a.txt", .{dir})); const a = p.view().active; @@ -731,6 +735,8 @@ test "an Edit with no command runs beside one whose commands run, unless it touc const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; const p = try th.withFile(testing.allocator, "b\na\n"); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var path: [4200]u8 = undefined; look.lookAt(p, 0, try std.fmt.bufPrint(&path, "{s}/other.txt", .{dir})); const other = p.view().active; diff --git a/core/jj.zig b/core/jj.zig index b278f4ba..05daeef6 100644 --- a/core/jj.zig +++ b/core/jj.zig @@ -2543,6 +2543,8 @@ test "At shows a file at a revision beside it, read-only, coloured as its file; defer repo.deinit(gpa); const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 40 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const file = p.view().active; @@ -2964,6 +2966,8 @@ test "Changes draws what the text has not where it stood, as ghost rows: a line for ([_]bool{ false, true }) |windowed| { const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 24, .windowed = windowed }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const id = p.view().active; @@ -3250,6 +3254,8 @@ test "a description is whole, its title and its author never cut: in a pane narr for ([_]bool{ false, true }) |windowed| { const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 50, .rows = 20, .windowed = windowed }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const id = p.view().active; @@ -3487,6 +3493,8 @@ test "at one place a change's ghost rows come before its description: a line it defer repo.deinit(gpa); const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 24, .windowed = false }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const pane = p.panes[p.view().active].?; @@ -3513,6 +3521,8 @@ test "a change the revset does not pin, between two it does, moves the older one defer repo.deinit(gpa); const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 24, .windowed = false }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const pane = p.panes[p.view().active].?; @@ -3605,6 +3615,8 @@ test "the layer's lines are the pane's text, read-only: j and k go onto them, a // query however long the test's directory makes the tags. const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 44, .windowed = windowed }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); const pane = try Lines.open(p, repo.file); @@ -4404,6 +4416,8 @@ test "Compare pins the whole difference between each two points as one change: t for ([_]bool{ false, true }) |windowed| { const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 70, .rows = 24, .windowed = windowed }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [4200]u8 = undefined; p.update(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }); const id = p.view().active; diff --git a/core/layout.zig b/core/layout.zig index c12780d8..c0d21d6d 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -2227,6 +2227,8 @@ test "a new pane goes below the rows a pane's text takes, a wrapped line's each const dir = buf[0..try tmp.dir.realPath(io, &buf)]; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 40 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; p.settings.wrap = true; // Two lines of 400 bytes: seven rows each at this width. const long = &@as([400]u8, @splat('a')); diff --git a/core/look.zig b/core/look.zig index b8d70fc2..443b32bc 100644 --- a/core/look.zig +++ b/core/look.zig @@ -1537,7 +1537,6 @@ fn walk(p: *Pardes, from: usize, path: []const u8, at: Spot) Landed { } const into = if (reads) from else Trail.readerOf(p, src) orelse { const free = openNew(p, from, path, at, .reader) orelse return .none; - p.panes[free].?.trail = Trail.reader(src.serial, path, at); return .{ .opened = free }; }; _ = Trail.step(p, into, path, at) catch |err| { @@ -1565,6 +1564,9 @@ fn openNew(p: *Pardes, from: usize, path: []const u8, at: Spot, kind: layout.New return null; }; nt.body.cur_col = columnOn(nt, nt.body.cur_row, at.col); + // A reader's walk (its owner's word, its place) is in its tag before + // it is placed: the rows it is given are for the tag it shows. + if (kind == .reader) nt.trail = Trail.reader(p.panes[from].?.serial, path, at); const failures = p.fs.failures; layout.placeNew(p, from, from, free, kind); // Refused a place: that is the look's one failure, not a miss of its @@ -2020,6 +2022,8 @@ test "a Look that opens a file in a pane of its own puts its line half the body' const dir = buf[0..try tmp.dir.realPath(io, &buf)]; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 40 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; p.settings.wrap = true; _ = try p.setTestFile("x\n"); var line: [4200]u8 = undefined; @@ -2213,6 +2217,8 @@ test "Look copies its operand before releasing pointer selection storage" { test "a Look whose column is past its line's end lands at the end, however big; a line past the file's is a miss" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 12 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try p.setTestFile("alpha\n\tbeta\n"); // Up to 2026-11-23 a column past i32 panicked the session (`@intCast` // in focusPaneLine): any text a B3 or Look takes, a server's row. @@ -2305,6 +2311,8 @@ test "Look on each kind of diff line opens the new file at the line it names" { defer fx.tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try fx.open(p, diff_text); DiffFixture.click(p, pane, 4); // @@: the hunk's first new line @@ -2357,6 +2365,8 @@ test "Look on plain diff -u output: names as written, timestamps cut, next to th defer fx.tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try fx.open(p, diff_text); DiffFixture.click(p, pane, 4); try expectAt(p, "/new/x.zig", 2); @@ -2384,6 +2394,8 @@ test "Look on a diff: headers and a hunk line's prefix are the whole line, hover defer fx.tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try fx.open(p, diff_text); pane.tag_expanded = false; // `word`: what the pointer there expands to when it is not the whole @@ -2542,6 +2554,8 @@ test "every entry point to Look takes one expansion: a diff line and a file:12:5 for (cases) |case| { const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try fx.open(p, case.text); p.gpa.free(pane.file.?.path); pane.file.?.path = try std.Io.Dir.path.join(p.gpa, &.{ fx.dir, case.name }); @@ -2686,6 +2700,8 @@ test "Incl's directories find a name found nowhere else, <name> too; bare Incl l const root = dir_buf[0..try tmp.dir.realPath(std.testing.io, &dir_buf)]; const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; // C's two by default. try std.testing.expectEqualStrings("/usr/include", p.incl.items[0]); const pane = try p.setTestFile("#include <pardes_incl_probe.h>\n"); @@ -2787,6 +2803,8 @@ test "Look on a diff under each git prefix opens the repository's file, and a re defer fx.tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try fx.open(p, c.text); DiffFixture.click(p, pane, 6); // `two`, a context line: new line 2 try std.testing.expect(!p.look_missed); @@ -2820,6 +2838,8 @@ test "Look on a diff line is the look of the address it names, selected by hand: for (0..2) |way| { const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try cache.open(p, patch); // The checkout's file, opened by a look from the diff pane. lookAt(p, 0, cargo); @@ -2868,6 +2888,8 @@ test "Plumb: a look sends what it looks at, the rules written first: a rule's wo const pic = try std.fmt.bufPrint(&pic_buf, "{s}/pic.svg", .{root}); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; const pane = try p.setTestFile("see https://ziglang.org here\n"); // The defaults: a URL to the web port, the host's opener; the hover // asks resolve, as before. diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index 2b599c76..69a398c4 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -543,6 +543,8 @@ test "Callstack always opens and focuses its own pane, reusing it for another sy if (!lsp.supports.contains(.callstack)) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; _ = try p.setTestFile("fn work() {}\n"); const source = p.panes[0].?; p.lspRequest(0, .callstack, ""); diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index e47aec94..637999c2 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -1747,6 +1747,8 @@ test "a look whose pane is refused a place fails with that alone, not a missing // A screen with rows for one pane only. const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 5 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; while (p.nextEffect()) |_| {} _ = try p.setTestFile("x\n"); while (p.nextEffect()) |_| {} @@ -2126,6 +2128,8 @@ test "with no pane at all, the root look opens its file and the root exec runs i if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "file\n" }); diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig index 01cfe297..4feb0153 100644 --- a/core/ninep/tree.zig +++ b/core/ninep/tree.zig @@ -2013,6 +2013,11 @@ test "random placements, refused or not, leave no pane under its tag and two row const rows = r.intRangeAtMost(u16, 6, 40); const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = r.intRangeAtMost(u16, 60, 240), .rows = rows }); defer p.deinit(); + // Placements as a Look made them before the walk: `Jumps new-pane` + // (SPEC §6.6). Under the walk a step in place can wrap its tag in a + // column with no rows to give (seed 109): the trail's give-way, + // not a placement's refusal (Trail.lift lifts it when there are). + p.settings.jumps = .@"new-pane"; while (p.nextEffect()) |_| {} _ = try p.setTestFile("x\n"); while (p.nextEffect()) |_| {} diff --git a/core/replica.zig b/core/replica.zig index 42ce3487..97cbaeee 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -5687,6 +5687,8 @@ test "a replica joined after a pane closed: the session's jump to it, its Panes const gpa = std.testing.allocator; const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host()); defer a.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + a.core.settings.jumps = .@"new-pane"; // A file looked at and closed: a jump to it, Recent's, a closed pane. var cwd: [std.Io.Dir.max_path_bytes]u8 = undefined; var line: [std.Io.Dir.max_path_bytes + 32]u8 = undefined; @@ -7335,6 +7337,7 @@ const may_wait = [_]Wait{ .{ .what = "*", .on = .shell, .stop = "pty_write", .why = "a key into a shell's program" }, // A file from the session's disk (P14). .{ .what = "Look *", .on = .any, .stop = "resolve", .why = "a name looked for on the session's disk" }, + .{ .what = "Look *", .on = .any, .stop = "read_file", .why = "a jump from a held pane (a kind's, a listing's) opens its reader on the file, read from the session's disk: a reading pane showing it is not focused (pick-ui SPEC §6.1)" }, .{ .what = "LookNext", .on = .any, .stop = "resolve", .why = "a Look's walk: each word asked of the disk" }, .{ .what = "LookPrev", .on = .any, .stop = "resolve", .why = "a Look's walk: each word asked of the disk" }, .{ .what = "Mini *", .on = .any, .stop = "resolve", .why = "a file opened by name, from the session's disk" }, diff --git a/core/rollback.zig b/core/rollback.zig index 2702594c..258a18d8 100644 --- a/core/rollback.zig +++ b/core/rollback.zig @@ -802,6 +802,8 @@ test "a rollback leaves the store and Recent as a speculation left them: they li const gpa = e.allocator(); const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml", .image_allocator = gpa, .tree_sitter_allocator = gpa, .frame_allocator = gpa }); p.pump(.{}) catch {}; + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var line: [std.Io.Dir.max_path_bytes + 16]u8 = undefined; p.update(.{ .command = try lookAt(&line, "build.zig.zon") }); p.update(.{ .command = "Del" }); |
