summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Band.zig4
-rw-r--r--core/TagState.zig2
-rw-r--r--core/draw.zig2
-rw-r--r--core/root.zig10
4 files changed, 10 insertions, 8 deletions
diff --git a/core/Band.zig b/core/Band.zig
index 8a433243..9fa204ee 100644
--- a/core/Band.zig
+++ b/core/Band.zig
@@ -415,8 +415,8 @@ pub fn wordAt(p: *Pardes, arena: std.mem.Allocator, id: usize, y: u16, col: u16)
}
fn bandLayer(p: *Pardes, id: usize) ?*pardes.Layer {
- const layer = &p.surface.tag_layers[pardes.BAND_LAYER_BASE + id];
- return if (layer.rows > 0 and layer.kind == .band) layer else null;
+ const layer = &p.surface.tag_layers[pardes.BAND_LAYER];
+ return if (layer.rows > 0 and layer.kind == .band and layer.id == id) layer else null;
}
fn layerRow(arena: std.mem.Allocator, layer: *const pardes.Layer, row: usize) ![]const u8 {
diff --git a/core/TagState.zig b/core/TagState.zig
index 204c6906..a0ac6353 100644
--- a/core/TagState.zig
+++ b/core/TagState.zig
@@ -719,7 +719,7 @@ test "SPC h k is describe-key: g d replays `g ▸ d Def` with its level and doc
// The level unrolled under the tag, the leaf on the cursor, its doc.
try std.testing.expect(pane.band_rows >= 4);
_ = try p.render(a);
- const layer = &p.surface.tag_layers[pardes.BAND_LAYER_BASE + p.view().active];
+ const layer = &p.surface.tag_layers[pardes.BAND_LAYER];
var text: std.ArrayList(u8) = .empty;
for (0..layer.rows) |row| for (layer.cells[row * layer.cols ..][0..layer.cols]) |cell| try text.appendSlice(a, cell.grapheme());
try std.testing.expect(std.mem.indexOf(u8, text.items, "▶ d Def") != null);
diff --git a/core/draw.zig b/core/draw.zig
index 772cbece..219bdfbf 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -822,7 +822,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
/// 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 {
- const layer = &s.tag_layers[pardes.BAND_LAYER_BASE + id];
+ 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();
diff --git a/core/root.zig b/core/root.zig
index b6835115..4a9b6e10 100644
--- a/core/root.zig
+++ b/core/root.zig
@@ -141,11 +141,13 @@ pub const TagKind = Layer.Kind;
/// too long for its width.
pub const MAX_TAG_ROWS = 8;
/// Panes, then columns, then the workspace bar, then each pane's notice
-/// bands: a band to a tag, however many lines it has; then each pane's
-/// rows unrolled under its tag (Band.zig).
-pub const MAX_TAG_LAYERS = BAND_LAYER_BASE + MAX_PANES;
+/// bands: a band to a tag, however many lines it has; then the rows
+/// unrolled under the one tag out of rest (Band.zig: a view has one, the
+/// keyboard's, SPEC §3.4). A frame makes many a temporary Surface, each
+/// with every layer: a layer to a pane here cost every frame 0.9%.
+pub const MAX_TAG_LAYERS = BAND_LAYER + 1;
pub const NOTICE_LAYER_BASE = MAX_PANES + MAX_COLS + 1;
-pub const BAND_LAYER_BASE = NOTICE_LAYER_BASE + MAX_PANES * Pane.Notices.max;
+pub const BAND_LAYER = NOTICE_LAYER_BASE + MAX_PANES * Pane.Notices.max;
/// Columns a session holds (each costs about 8 KB of state, a column tag
/// being most of it).
pub const MAX_COLS = 16;