summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 20:30:57 -0300
committerGabriel Schneider <[email protected]>2026-11-24 20:30:57 -0300
commitbcbfd846aca7629f7fdf25f45954c5a8da2469f5 (patch)
treeeddee0d3939212cdc9cf8ffc41c897ccc937ace4 /core
parent68155195b3b968682a29392bdc5e5d3ad8c9d0a6 (diff)
downloadpardes-bcbfd846aca7629f7fdf25f45954c5a8da2469f5.tar.gz
pardes-bcbfd846aca7629f7fdf25f45954c5a8da2469f5.zip
TagState: a terminal's rolled level takes no more tag rows than its own text (a fix on top of item 2, uqopxwqz, frozen): the rolled level wraps to three rows, and a terminal's body is its pty, so a which-key that took a row resized the program under it (SIGWINCH) at every SPC or C-w held past its delay in a terminal in normal mode; its room is now the rows its own text takes at rest (layout.wantedTagRows), the rest `…` as past three rows; TEST: TagState.zig "a terminal's rolled level takes no more tag rows than its own text: its pty keeps its size" (shell-test, which has a shell)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core')
-rw-r--r--core/TagState.zig26
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);
+}