summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig35
1 files changed, 13 insertions, 22 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 8c946787..39e04f62 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -2049,36 +2049,27 @@ pub fn sync(p: *Pardes) void {
caret_row = std.mem.count(u8, shown.text[0..@min(shown.fromReal(cur), shown.text.len)], "\n");
}
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 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;
- }
+ // Out of rest the tag keeps exactly the rows its own text takes at
+ // rest: its head's rows past them and the band under it are drawn
+ // over the top rows of its body, which never move for them (UX
+ // DESIGN I1, Band.covered); its head is drawn whole from its first
+ // row. A picker's preview starts under them, as a file's first
+ // lines could not be put under a band otherwise (Pick.previewing).
+ const host = pardes.TagState.hostOf(p) == id and !pane.collapsed;
+ if (host) wanted = layout.wantedTagRows(p, id);
pane.tag_rows = @intCast(@min(wanted, MAX_TAG_ROWS, @max(BOX_H, r.h -| 1)));
if (pane.collapsed) pane.tag_rows = BOX_H;
- if (pane.focus == .tag and pane.prompt != .name) {
+ if (pane.focus == .tag and pane.prompt != .name and !host) {
const cur: usize = caret_row;
var top: usize = pane.tag_top;
if (cur < top) top = cur;
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 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 over = if (host) pardes.Band.covered(p, pane, id).over else 0;
+ const preview = host and pardes.Pick.previewing(p, id);
+ if (preview) pane.tag_rows += over;
+ pane.view.covered = if (preview) 0 else over;
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