Commit 06a0f36fc9

06a0f36fc90faa403e278be8808059f726c9d38e

parent: 79b6abf507

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-11 04:30 UTC

Editor panes and pane layout in the session

Layout: unified · split

Sources/OrgApp/DocumentSession.swift +160 −90
@@ -42,30 +42,36 @@ public enum SaveMode: String, Sendable, CaseIterable {
4242 case explicit
4343}
4444
45/// The files open in a window, as Emacs's buffers: each keeps its text, caret, undo and
46/// unsaved edits while another is shown. The current buffer's outline, saving and requests
47/// for the editor to show a location are what most views use. The view layer attaches an
48/// editor to each buffer and follows `path` and `revealRequest`.
45/// The files open in the app, as Emacs's buffers: each keeps its text, caret, undo and
46/// unsaved edits while another is shown. Buffers show in panes (`EditorPane`), one or more
47/// per window; `focused` is the pane commands and menus act on, and the properties below
48/// that describe one buffer (`path`, `outline`, `isDirty`, `conflict`, `revealRequest`) are
49/// its. The view layer attaches an editor to each buffer and, per pane, follows the pane's
50/// `path` and `revealRequest`.
4951@MainActor
5052@Observable
5153public final class DocumentSession {
52 /// The current buffer's file.
53 public private(set) var path: String?
54 /// A copy of the current buffer's state as of its last change. Not observed: it changes
55 /// on every keystroke; views follow `path`, `isDirty` and `outline`.
56 @ObservationIgnored public private(set) var document: DocumentState?
57 public private(set) var outline: [OutlineEntry] = []
58 /// Bumped when the buffer settles after edits, and when a file opens: views that read
59 /// `document` follow this.
60 public private(set) var editVersion = 0
61 public private(set) var isDirty = false
54 /// Where buffers show. There is always at least one.
55 public private(set) var panes: [EditorPane]
56 /// The pane with focus: what `open`, `reveal`, saving and the forwarders below act on.
57 public var focused: EditorPane
58 /// The focused pane's file.
59 public var path: String? { focused.path }
60 /// The focused pane's buffer state. Not observed: it changes on every keystroke; views
61 /// follow `path`, `isDirty` and `outline`.
62 public var document: DocumentState? { current?.buffer.document }
63 public var outline: [OutlineEntry] { focused.outline }
64 /// Bumped when the focused buffer settles after edits, and when a file opens: views that
65 /// read `document` follow this.
66 public var editVersion: Int { focused.editVersion }
67 public var isDirty: Bool { focused.isDirty }
6268 /// The file isn't UTF-8, so it can't be edited or saved.
63 public private(set) var isReadOnly = false
64 /// Set while the buffer and the file on disk conflict; says how to resolve it.
65 public private(set) var conflict: String?
66 /// Bumped to ask the editor to reveal an offset.
67 public private(set) var revealRequest: (offset: Int, id: Int)?
68 /// Open files, in the order buffers were opened (each after the one current then).
69 public var isReadOnly: Bool { focused.isReadOnly }
70 /// Set while the focused buffer and the file on disk conflict; says how to resolve it.
71 public var conflict: String? { focused.conflict }
72 /// Bumped to ask the focused pane's editor to reveal an offset.
73 public var revealRequest: (offset: Int, id: Int)? { focused.revealRequest }
74 /// Open files, in the order buffers were opened (each after the one focused then).
6975 public private(set) var openPaths: [String] = []
7076 /// Open files with unsaved edits.
7177 public private(set) var dirtyPaths: Set<String> = []
@@ -91,8 +97,10 @@ public final class DocumentSession {
9197 public func refreshSetup() {
9298 guard let entry = current else { return }
9399 resolveSetup(entry)
94 refresh()
95 editVersion += 1
100 for pane in panes(showing: entry.path) {
101 refresh(pane)
102 pane.editVersion += 1
103 }
96104 }
97105
98106 /// The entry's setup files read again, as its text names them now.
@@ -118,10 +126,11 @@ public final class DocumentSession {
118126 private let fileSystem: FileSystem
119127 private let recovery: RecoveryStore
120128 @ObservationIgnored private var entries: [Entry] = []
121 @ObservationIgnored private var current: Entry?
122 /// Paths, most recently shown first.
129 /// The focused pane's buffer.
130 private var current: Entry? { focused.path.flatMap(entry) }
131 /// Paths, most recently shown first, across every pane.
123132 @ObservationIgnored private var history: [String] = []
124 @ObservationIgnored private var outlineUpdate: Task<Void, Never>?
133 @ObservationIgnored private var outlineUpdates: [String: Task<Void, Never>] = [:]
125134 private var requestID = 0
126135
127136 public init(
@@ -130,10 +139,34 @@ public final class DocumentSession {
130139 ) {
131140 self.fileSystem = fileSystem
132141 self.recovery = recovery
142 let pane = EditorPane()
143 panes = [pane]
144 focused = pane
145 }
146
147 // MARK: - Panes
148
149 /// A new, empty pane.
150 public func makePane() -> EditorPane {
151 let pane = EditorPane()
152 panes.append(pane)
153 return pane
154 }
155
156 /// Removes `pane`; its buffers stay open. The last pane stays.
157 public func closePane(_ pane: EditorPane) {
158 guard panes.count > 1, let index = panes.firstIndex(where: { $0 === pane }) else { return }
159 panes.remove(at: index)
160 if focused === pane { focused = panes[0] }
161 }
162
163 /// The panes showing `path`.
164 private func panes(showing path: String) -> [EditorPane] {
165 panes.filter { $0.path == path }
133166 }
134167
135168 private var buffer: DocumentBuffer? { current?.buffer }
136 /// The current buffer's pending autosave, for tests to wait on.
169 /// The focused buffer's pending autosave, for tests to wait on.
137170 var autosave: Task<Void, Never>? { current?.autosave }
138171 private var url: URL? { path.map { URL(fileURLWithPath: $0) } }
139172 /// Whether the open file is an org file (`.org`, `.org_archive`), not plain text.
@@ -186,12 +219,17 @@ public final class DocumentSession {
186219 /// Open buffers, most recently shown first.
187220 public var recentPaths: [String] { history.filter(isOpen) }
188221
189 /// Shows the buffer of `path`, opening the file if it isn't open.
222 /// Shows the buffer of `path` in the focused pane, opening the file if it isn't open.
190223 public func open(_ path: String) {
224 open(path, in: focused)
225 }
226
227 /// Shows the buffer of `path` in `pane`, opening the file if it isn't open.
228 public func open(_ path: String, in pane: EditorPane) {
191229 let interval = Perf.begin("session.open")
192230 defer { interval.end((path as NSString).lastPathComponent) }
193231 if let existing = entry(path) {
194 activate(existing)
232 show(existing, in: pane)
195233 return
196234 }
197235 do {
@@ -200,108 +238,141 @@ public final class DocumentSession {
200238 return
201239 }
202240 let entry = Entry(path: path, buffer: StateBuffer(loaded(bytes, path: path)))
203 let index = current.flatMap { c in entries.firstIndex { $0 === c } }.map { $0 + 1 } ?? entries.count
241 let index = pane.path.flatMap(self.entry).flatMap { c in entries.firstIndex { $0 === c } }.map { $0 + 1 } ?? entries.count
204242 entries.insert(entry, at: index)
205 activate(entry)
243 show(entry, in: pane)
206244 } catch {
207245 lastError = "Can't open \(path): \(error.localizedDescription)"
208246 }
209247 }
210248
211 private func activate(_ entry: Entry) {
212 current = entry
213 path = entry.path
214 conflict = entry.conflict
215 revealRequest = nil
249 private func show(_ entry: Entry, in pane: EditorPane) {
250 pane.path = entry.path
251 if !pane.shown.contains(entry.path) { pane.shown.append(entry.path) }
252 pane.history.removeAll { $0 == entry.path }
253 pane.history.insert(entry.path, at: 0)
254 pane.revealRequest = nil
216255 history.removeAll { $0 == entry.path }
217256 history.insert(entry.path, at: 0)
218 refresh()
257 refresh(pane)
219258 }
220259
221 /// The buffer before or after the current one, wrapping.
260 /// The buffer before or after the focused one, wrapping, in the focused pane.
222261 public func cycle(_ step: Int) {
223262 guard let current, let index = entries.firstIndex(where: { $0 === current }), entries.count > 1 else { return }
224 activate(entries[((index + step) % entries.count + entries.count) % entries.count])
263 show(entries[((index + step) % entries.count + entries.count) % entries.count], in: focused)
225264 }
226265
227 /// The buffer shown before the current one.
266 /// The buffer shown before the focused one.
228267 public func showPrevious() {
229268 guard let previous = recentPaths.dropFirst().first else { return }
230269 open(previous)
231270 }
232271
233 /// Closes the buffer of `path` without saving it; the most recent other buffer shows.
272 /// Closes the buffer of `path` without saving it. A pane showing it shows the buffer it
273 /// showed before, else the most recent other buffer, else nothing.
234274 public func kill(_ path: String) {
235275 guard let entry = entry(path) else { return }
236276 entry.autosave?.cancel()
237277 entries.removeAll { $0 === entry }
238278 history.removeAll { $0 == path }
239 if entry === current {
240 current = nil
241 if let next = recentPaths.first.flatMap(self.entry) ?? entries.last {
242 activate(next)
279 outlineUpdates[path]?.cancel()
280 outlineUpdates[path] = nil
281 for pane in panes {
282 pane.shown.removeAll { $0 == path }
283 pane.history.removeAll { $0 == path }
284 guard pane.path == path else { continue }
285 if let next = pane.history.first.flatMap(self.entry) ?? recentPaths.first.flatMap(self.entry) ?? entries.last {
286 show(next, in: pane)
243287 } else {
244 outlineUpdate?.cancel()
245 self.path = nil
246 document = nil
247 outline = []
248 isDirty = false
249 conflict = nil
250 revealRequest = nil
251 refreshLists()
288 pane.path = nil
289 pane.outline = []
290 pane.isDirty = false
291 pane.isReadOnly = false
292 pane.conflict = nil
293 pane.revealRequest = nil
252294 }
253 } else {
254 refreshLists()
255295 }
296 refreshLists()
256297 }
257298
258 /// Closes the current buffer without saving, as when its file was deleted.
299 /// Closes the focused buffer without saving, as when its file was deleted.
259300 public func close() {
260301 if let path { kill(path) }
261302 }
262303
263 /// Makes `buffer`, built from `document`, the live state of the current file.
304 /// Makes `buffer`, built from `document`, the live state of the focused file.
264305 public func attach(_ buffer: DocumentBuffer) {
265 current?.buffer = buffer
266 refresh()
306 if let path { attach(buffer, for: path) }
307 }
308
309 /// Makes `buffer`, built from the file's `document`, the live state of `path`.
310 public func attach(_ buffer: DocumentBuffer, for path: String) {
311 guard let entry = entry(path) else { return }
312 entry.buffer = buffer
313 for pane in panes(showing: path) { refresh(pane) }
267314 }
268315
269 /// The buffer of `path` changed in its editor: the current one updates its views, another
270 /// saves on its own.
316 /// The buffer of `path` changed in its editor: the panes showing it update their views
317 /// once typing pauses, and it saves on its own.
271318 public func bufferChanged(_ path: String) {
272319 guard let entry = entry(path) else { return }
273 if entry === current { bufferChanged() } else { scheduleAutosave(entry); refreshLists() }
320 changed(entry)
274321 }
275322
276 /// The buffer changed through typing. The outline follows once typing pauses.
323 /// The focused buffer changed through typing.
277324 public func bufferChanged() {
278 refresh(outline: false)
279 outlineUpdate?.cancel()
280 outlineUpdate = Task { [weak self] in
281 try? await Task.sleep(for: .milliseconds(300))
282 guard !Task.isCancelled, let self, let document = self.document else { return }
283 self.outline = self.isOrg ? Presentation.outline(document.tree) : []
284 self.editVersion += 1
325 if let current { changed(current) }
326 }
327
328 /// A buffer changed, typed or not: the panes showing it update their views, the outline
329 /// once typing pauses, and it saves on its own.
330 private func changed(_ entry: Entry) {
331 let showing = panes(showing: entry.path)
332 for pane in showing { refresh(pane, outline: false) }
333 outlineUpdates[entry.path]?.cancel()
334 if !showing.isEmpty {
335 let path = entry.path
336 outlineUpdates[path] = Task { [weak self, weak entry] in
337 try? await Task.sleep(for: .milliseconds(300))
338 guard !Task.isCancelled, let self, let entry else { return }
339 let outline = Self.isOrgPath(path) ? Presentation.outline(entry.buffer.document.tree) : []
340 for pane in self.panes(showing: path) {
341 pane.outline = outline
342 pane.editVersion += 1
343 }
344 }
285345 }
286 if let current { scheduleAutosave(current) }
346 scheduleAutosave(entry)
347 refreshLists()
287348 }
288349
289 private func refresh(outline updateOutline: Bool = true) {
350 /// `pane`'s view of its buffer, from the buffer's state.
351 private func refresh(_ pane: EditorPane, outline updateOutline: Bool = true) {
290352 let interval = Perf.begin("session.refresh")
291353 defer { interval.end() }
292354 refreshLists()
293 guard let buffer else { return }
294 let state = buffer.document
295 document = state
296 if isDirty != state.isDirty { isDirty = state.isDirty }
297 if isReadOnly == state.isEditable { isReadOnly = !state.isEditable }
298 if conflict != current?.conflict { conflict = current?.conflict }
355 guard let entry = pane.path.flatMap(entry) else { return }
356 let state = entry.buffer.document
357 if pane.isDirty != state.isDirty { pane.isDirty = state.isDirty }
358 if pane.isReadOnly == state.isEditable { pane.isReadOnly = !state.isEditable }
359 if pane.conflict != entry.conflict { pane.conflict = entry.conflict }
299360 if updateOutline {
300 outline = isOrg ? Presentation.outline(state.tree) : []
301 editVersion += 1
361 pane.outline = Self.isOrgPath(entry.path) ? Presentation.outline(state.tree) : []
362 pane.editVersion += 1
302363 }
303364 }
304365
366 /// Every pane showing `entry`, from the buffer's state.
367 private func refresh(_ entry: Entry) {
368 for pane in panes(showing: entry.path) { refresh(pane) }
369 }
370
371 /// The focused pane, from its buffer's state.
372 private func refresh() {
373 refresh(focused)
374 }
375
305376 private func refreshLists() {
306377 let paths = entries.map(\.path)
307378 if paths != openPaths { openPaths = paths }
@@ -366,7 +437,7 @@ public final class DocumentSession {
366437 } catch {
367438 lastError = "Can't save \(name): \(error.localizedDescription)"
368439 }
369 if entry === current { refresh() } else { refreshLists() }
440 refresh(entry)
370441 return !entry.buffer.document.isDirty
371442 }
372443
@@ -669,9 +740,7 @@ public final class DocumentSession {
669740 do {
670741 let options = self.options
671742 let step = try buffer.update { try $0.run(command, selection: [offset..<offset], now: now, answers: answers, options: options) }
672 if case .commit = step {
673 if entry === current { bufferChanged() } else { scheduleAutosave(entry); refreshLists() }
674 }
743 if case .commit = step { changed(entry) }
675744 return step
676745 } catch {
677746 return .failed("\(error)")
@@ -830,11 +899,6 @@ public final class DocumentSession {
830899 babelTask?.cancel()
831900 }
832901
833 /// A buffer changed outside typing: the current one updates its views, another saves.
834 private func changed(_ entry: Entry) {
835 if entry === current { bufferChanged() } else { scheduleAutosave(entry); refreshLists() }
836 }
837
838902 // MARK: - Locations
839903
840904 /// Opens the file of `location` if needed and asks the editor to show the heading. Offsets
@@ -859,9 +923,15 @@ public final class DocumentSession {
859923 reveal(offset)
860924 }
861925
926 /// Asks the focused pane's editor to show `offset`.
862927 public func reveal(_ offset: Int) {
928 reveal(offset, in: focused)
929 }
930
931 /// Asks `pane`'s editor to show `offset`.
932 public func reveal(_ offset: Int, in pane: EditorPane) {
863933 requestID += 1
864 revealRequest = (offset, requestID)
934 pane.revealRequest = (offset, requestID)
865935 }
866936
867937 /// Called when the workspace sees a file change on disk: an open buffer of it takes the
@@ -885,6 +955,6 @@ public final class DocumentSession {
885955 case .unchanged:
886956 break
887957 }
888 if entry === current { refresh() } else { refreshLists() }
958 refresh(entry)
889959 }
890960}
Sources/OrgApp/EditorPane.swift added +30
@@ -0,0 +1,30 @@
1import Foundation
2import OrgCore
3import OrgPresentation
4
5/// One place a buffer shows, as a window shows a buffer in Emacs: which file, the buffers it
6/// has shown (its tabs), and what the editor view in it follows. The session keeps these in
7/// step with the buffers.
8@MainActor
9@Observable
10public final class EditorPane: Identifiable {
11 public let id = PaneID()
12 /// The file shown, nil for an empty pane.
13 public internal(set) var path: String?
14 /// Open files this pane has shown, in the order it first showed them: its tabs.
15 public internal(set) var shown: [String] = []
16 /// Files this pane has shown, most recent first.
17 public internal(set) var history: [String] = []
18 public internal(set) var outline: [OutlineEntry] = []
19 /// Bumped when the shown buffer settles after edits, and when a file opens here.
20 public internal(set) var editVersion = 0
21 public internal(set) var isDirty = false
22 /// The file isn't UTF-8, so it can't be edited or saved.
23 public internal(set) var isReadOnly = false
24 /// Set while the shown buffer and the file on disk conflict; says how to resolve it.
25 public internal(set) var conflict: String?
26 /// Bumped to ask the editor in this pane to reveal an offset.
27 public internal(set) var revealRequest: (offset: Int, id: Int)?
28
29 public init() {}
30}
Sources/OrgApp/PaneLayout.swift added +58
@@ -0,0 +1,58 @@
1import Foundation
2
3/// Identifies a pane for as long as it exists.
4public struct PaneID: Hashable, Sendable {
5 private let raw = UUID()
6 public init() {}
7}
8
9/// How a window divides its editor area: one pane, or two layouts side by side (`horizontal`)
10/// or one above the other (`vertical`), with the first's share of the space.
11public indirect enum PaneLayout: Equatable, Sendable {
12 public enum Axis: Equatable, Sendable { case horizontal, vertical }
13
14 case pane(PaneID)
15 case split(axis: Axis, first: PaneLayout, second: PaneLayout, fraction: Double)
16
17 /// Panes in reading order: left before right, top before bottom.
18 public var panes: [PaneID] {
19 switch self {
20 case .pane(let id): [id]
21 case .split(_, let first, let second, _): first.panes + second.panes
22 }
23 }
24
25 /// `id` halved along `axis`, with `new` after it.
26 public func splitting(_ id: PaneID, axis: Axis, new: PaneID) -> PaneLayout {
27 switch self {
28 case .pane(id): .split(axis: axis, first: .pane(id), second: .pane(new), fraction: 0.5)
29 case .pane: self
30 case .split(let a, let first, let second, let fraction):
31 .split(axis: a, first: first.splitting(id, axis: axis, new: new), second: second.splitting(id, axis: axis, new: new), fraction: fraction)
32 }
33 }
34
35 /// The layout without `id`; its sibling takes the space. Nil when `id` was the only pane.
36 public func removing(_ id: PaneID) -> PaneLayout? {
37 switch self {
38 case .pane(id): nil
39 case .pane: self
40 case .split(let axis, let first, let second, let fraction):
41 switch (first.removing(id), second.removing(id)) {
42 case (nil, let rest?), (let rest?, nil): rest
43 case (let a?, let b?): .split(axis: axis, first: a, second: b, fraction: fraction)
44 case (nil, nil): nil
45 }
46 }
47 }
48
49 /// Only `id`, filling the window.
50 public func only(_ id: PaneID) -> PaneLayout { .pane(id) }
51
52 /// The pane after `id` in reading order, wrapping; the first when `id` isn't here.
53 public func next(after id: PaneID) -> PaneID {
54 let all = panes
55 guard let index = all.firstIndex(of: id) else { return all[0] }
56 return all[(index + 1) % all.count]
57 }
58}
Tests/OrgAppTests/EditorPaneTests.swift added +87
@@ -0,0 +1,87 @@
1import Foundation
2import OrgCore
3import OrgDocument
4import Testing
5@testable import OrgApp
6
7@MainActor
8struct EditorPaneTests {
9 func session(_ notes: Folder) -> DocumentSession {
10 DocumentSession(recovery: FileRecoveryStore(directory: notes.url.appendingPathComponent(".r")))
11 }
12
13 @Test func aFileOpenInTwoPanesIsOneBuffer() throws {
14 let notes = try Folder()
15 let a = try notes.write("a.org", "* A\n").path
16 let session = session(notes)
17 let first = session.focused
18 let second = session.makePane()
19 session.open(a)
20 session.open(a, in: second)
21 #expect(session.openPaths == [a])
22 #expect(first.path == a && second.path == a)
23 #expect(session.panes.count == 2)
24 }
25
26 @Test func killingABufferEmptiesEveryPaneShowingIt() throws {
27 let notes = try Folder()
28 let a = try notes.write("a.org", "* A\n").path
29 let b = try notes.write("b.org", "* B\n").path
30 let session = session(notes)
31 let first = session.focused
32 let second = session.makePane()
33 session.open(a)
34 session.open(b)
35 session.open(b, in: second)
36 session.kill(b)
37 #expect(first.path == a)
38 #expect(second.path == a)
39 #expect(first.shown == [a] && second.shown == [a])
40 session.kill(a)
41 #expect(first.path == nil && second.path == nil && session.path == nil)
42 }
43
44 @Test func revealGoesToOnePane() throws {
45 let notes = try Folder()
46 let a = try notes.write("a.org", "* A\n* B\n").path
47 let session = session(notes)
48 let first = session.focused
49 let second = session.makePane()
50 session.open(a)
51 session.open(a, in: second)
52 session.reveal(4, in: second)
53 #expect(second.revealRequest?.offset == 4)
54 #expect(first.revealRequest == nil)
55 session.focused = second
56 #expect(session.revealRequest?.offset == 4)
57 }
58
59 @Test func dirtyPathsCountABufferOnce() throws {
60 let notes = try Folder()
61 let a = try notes.write("a.org", "* A\n").path
62 let session = session(notes)
63 session.saveMode = .explicit
64 let second = session.makePane()
65 session.open(a)
66 session.open(a, in: second)
67 let result = EditResult(baseRevision: session.document!.revision, edits: [TextEdit(range: 0..<0, replacement: "x")])
68 _ = session.perform(PrecomputedEdit(result), path: a, at: 0, expect: nil)
69 #expect(session.dirtyPaths == [a])
70 #expect(session.focused.isDirty && second.isDirty)
71 }
72
73 @Test func closingAPaneKeepsTheBufferAndTheFocus() throws {
74 let notes = try Folder()
75 let a = try notes.write("a.org", "* A\n").path
76 let session = session(notes)
77 let first = session.focused
78 let second = session.makePane()
79 session.open(a, in: second)
80 session.focused = second
81 session.closePane(second)
82 #expect(session.panes.count == 1 && session.focused === first)
83 #expect(session.isOpen(a))
84 session.closePane(first)
85 #expect(session.panes.count == 1)
86 }
87}
Tests/OrgAppTests/PaneLayoutTests.swift added +30
@@ -0,0 +1,30 @@
1import Testing
2@testable import OrgApp
3
4struct PaneLayoutTests {
5 @Test func splitsNestAndReadInOrder() {
6 let a = PaneID(), b = PaneID(), c = PaneID()
7 var layout = PaneLayout.pane(a)
8 layout = layout.splitting(a, axis: .horizontal, new: b)
9 layout = layout.splitting(b, axis: .vertical, new: c)
10 #expect(layout.panes == [a, b, c])
11 #expect(layout == .split(axis: .horizontal, first: .pane(a), second: .split(axis: .vertical, first: .pane(b), second: .pane(c), fraction: 0.5), fraction: 0.5))
12 }
13
14 @Test func removingAPaneCollapsesItsSplit() {
15 let a = PaneID(), b = PaneID(), c = PaneID()
16 let layout = PaneLayout.pane(a).splitting(a, axis: .horizontal, new: b).splitting(b, axis: .vertical, new: c)
17 #expect(layout.removing(b) == .split(axis: .horizontal, first: .pane(a), second: .pane(c), fraction: 0.5))
18 #expect(layout.removing(a)?.panes == [b, c])
19 #expect(PaneLayout.pane(a).removing(a) == nil)
20 }
21
22 @Test func onlyAndNext() {
23 let a = PaneID(), b = PaneID(), c = PaneID()
24 let layout = PaneLayout.pane(a).splitting(a, axis: .horizontal, new: b).splitting(b, axis: .vertical, new: c)
25 #expect(layout.only(b) == .pane(b))
26 #expect(layout.next(after: a) == b)
27 #expect(layout.next(after: c) == a)
28 #expect(layout.next(after: PaneID()) == a)
29 }
30}