summaryrefslogtreecommitdiff
path: root/core/draw.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/draw.zig')
-rw-r--r--core/draw.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 17ac7514..f69f83c6 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -357,6 +357,12 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface {
s.body_layers[id].rows = 0;
try renderPane(p, s, arena, pane, v.rects[id], id, id == v.active);
}
+ // A band over a terminal's or a kind's body (Band.over), drawn after
+ // the body it covers.
+ if (TagState.hostOf(p)) |id| if (p.panes[id]) |pane| if (pane.band_rows == 0) {
+ const rows = pardes.Band.shownRows(p, pane, id);
+ if (rows > 0) try joinBand(p, s, arena, pane, v.rects[id], id, id == v.active, rows);
+ };
// Each notice once, as a tag layer, and the grid's chip a copy of it.
for (s.regionList()) |region| {
if (region.kind == .notice) try joinNotice(p, s, arena, region);
@@ -495,7 +501,7 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r:
try joinPaneTag(p, s, arena, pane, r, id, active);
// The keyboard is in the head's field: its caret, not the body's.
const head_caret = if (typing) s.cursor else null;
- if (pane.band_rows > 0) try joinBand(p, s, arena, pane, r, id, active);
+ if (pane.band_rows > 0) try joinBand(p, s, arena, pane, r, id, active, pane.band_rows);
// Folded panes retain their body state, but neither body pixels nor
// its cursor belong outside the one-row tag rectangle.
@@ -868,14 +874,13 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
/// layer at the tagline's pitch, a row to a line, and copied into the
/// grid: the spines and steps in the tag's tint, the keys in the key ink,
/// the cursor's row tinted as a selection.
-fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool) !void {
+fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool, rows: u16) !void {
const layer = &s.tag_layers[pardes.BAND_LAYER];
if (r.w <= TAG_TEXT_INSET) return;
const band = (try pardes.Band.of(p, arena, pane, id)) orelse return;
const th = p.theme();
const chrome = p.chromeTheme();
const tab = p.settings.tab;
- const rows = pane.band_rows;
const columns = @max(band.columns, 1);
const bg = tagGround(p, pane, active);
const fg = if (active) chrome.tag_active_fg else chrome.tag_fg;
@@ -921,7 +926,9 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
const count = @as(usize, columns) * rows;
if (layer.cells.len != count) layer.cells = try p.gpa.realloc(layer.cells, count);
@memcpy(layer.cells, storage);
- const y0 = p.tagTop(pane, r) + (pane.tag_rows - rows);
+ // Under the tag's text rows; a terminal's or a kind's over its body's
+ // top rows (Band.over).
+ const y0 = p.tagTop(pane, r) + (pane.tag_rows - pane.band_rows);
layer.kind = .band;
layer.id = @intCast(id);
layer.serial = pane.serial;