diff options
Diffstat (limited to 'core/Core.zig')
| -rw-r--r-- | core/Core.zig | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/core/Core.zig b/core/Core.zig index 5b6eba75..cd2254c2 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -2043,13 +2043,15 @@ pub fn sync(p: *Pardes) void { } if (!pane.tag_expanded) wanted = 1; // Out of rest the head is the tag's text (TagState), and the tag - // keeps the rows its own text takes at least: a head shorter than - // it (a root's key cell, before its level shows) moved the body up - // and back down a moment later; a terminal's exactly those, its pty - // its body (a resize the program under it saw at every C-w and SPC). - if (pardes.TagState.hostOf(p) == id) { - const rest = layout.wantedTagRows(p, id); - wanted = if (pane.isTerminal()) rest else @max(wanted, rest); + // keeps the rows its own text takes at rest at least: a head shorter + // than it (a root's key cell, before its level shows) moved the body + // up and back down a moment later; a terminal's exactly those, its + // pty its body (a resize the program under it saw at every C-w and + // SPC). A band takes the kept rows first (below). + var kept: usize = 0; + if (pardes.TagState.hostOf(p) == id and !pane.collapsed) { + kept = layout.wantedTagRows(p, id); + if (pane.isTerminal()) wanted = kept; } pane.tag_rows = @intCast(@min(wanted, MAX_TAG_ROWS, @max(BOX_H, r.h -| 1))); if (pane.collapsed) pane.tag_rows = BOX_H; @@ -2060,11 +2062,16 @@ pub fn sync(p: *Pardes) void { if (cur >= top + pane.tag_rows) top = cur + 1 - pane.tag_rows; pane.tag_top = @intCast(@min(top, lines -| pane.tag_rows)); } else pane.tag_top = 0; - // The band unrolled under the tag's text pushes the body down: - // the tag's rows, as everything under them counts them. - // A terminal's or a kind's is drawn over its body instead (Band.over). - pane.band_rows = if (pane.collapsed or pardes.Band.over(pane)) 0 else @min(pardes.Band.takes(p, id), r.h -| pane.tag_rows -| pardes.Band.body_rows); - pane.tag_rows += pane.band_rows; + // The band unrolled under the head pushes the body down: the tag's + // rows, as everything under them counts them. Its first row is the + // one under the head's last, and the rows the tag keeps from rest + // are its own (UX E3: never a blank row between a head and its + // rows); with no band they stay the tag's, blank. A terminal's or + // a kind's is drawn over its body instead (Band.over). + const band = if (pane.collapsed or pardes.Band.over(pane)) 0 else @min(pardes.Band.takes(p, id), r.h -| pane.tag_rows -| pardes.Band.body_rows); + const keep: u16 = @intCast(@min(kept, MAX_TAG_ROWS, @max(BOX_H, r.h -| 1))); + pane.band_rows = if (band == 0) 0 else @max(band, keep -| pane.tag_rows); + pane.tag_rows = @max(keep, pane.tag_rows + pane.band_rows); const cols = @max(1, r.w -| config.GUTTER); // The tag steals the top rows. The pty is what the pane shows // (layout keeps a terminal two body rows where the window has |
