diff options
| -rw-r--r-- | core/TagState.zig | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/core/TagState.zig b/core/TagState.zig index 342c9812..204c6906 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -484,11 +484,14 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { } try b.styled("▸", .key); // The rolled level wraps to three rows at most (SPEC §3.6): what does - // not fit is `…`, and `↓` unrolls it whole. + // not fit is `…`, and `↓` unrolls it whole. A terminal's to the rows its + // own text takes: its pty is its body, and a which-key that took a row + // would resize the program under it at every SPC. const hint = " ↓ unroll · ? help"; const prefix = try tagline.prefixIn(p, arena, pane); const tab = p.settings.tab; - const room = 3 * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, prefix) -| panes.File.displayWidth(tab, hint) -| 2; + const most: usize = if (pane.isTerminal()) @import("layout.zig").wantedTagRows(p, id) else 3; + const room = most * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, prefix) -| panes.File.displayWidth(tab, hint) -| 2; var children: [bindings.max_children]bindings.Child = undefined; const used = s.used[node.group]; for (bindings.level(p, cur.root, cur.path, &children)) |c| { @@ -786,3 +789,22 @@ test "a root struck in a pump, after its advance, wakes the loop for the next fr try std.testing.expect(shown(p, p.view())); try std.testing.expect(p.nextWake() == null); } + +test "a terminal's rolled level takes no more tag rows than its own text: its pty keeps its size" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell + const p = try Pardes.init(std.testing.allocator, .{ .file = "mise.toml", .cols = 40, .rows = 30 }); + defer p.deinit(); + _ = pardes.exec.spawnTty(p, 0); + const shell = p.view().active; + const pane = p.panes[shell].?; + pane.body.mode = .normal; + p.sync(); + const rows, const tag_rows = .{ pane.rows, pane.tag_rows }; + p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + p.sync(); + try std.testing.expect(hostOf(p) == shell); + try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expectEqual(rows, pane.rows); +} |
