summaryrefslogtreecommitdiff
path: root/src/draw.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-08 12:03:46 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commit1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (patch)
tree973976c63f560201638d453b4b8b277d9cb40040 /src/draw.zig
parent13d5613b77c62c425c3a124a34c0c2528cc6251f (diff)
downloadpardes-1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2.tar.gz
pardes-1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2.zip
Add a readable static Callstack pane and align tagline text
Diffstat (limited to 'src/draw.zig')
-rw-r--r--src/draw.zig18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/draw.zig b/src/draw.zig
index 9fcbb15f..b35d55e8 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -412,15 +412,15 @@ fn recede(p: *Pardes, s: *Surface, id: usize, amount: f32, focused: bool) void {
}
}
const body = &s.body_layers[id];
- if (body.rows != 0) for (body.cells[0..@as(usize, body.cols) * body.rows]) |*cell| {
+ if (body.rows != 0) for (body.cells[0 .. @as(usize, body.cols) * body.rows]) |*cell| {
if (!(focused and selected(cell, th.sel_bg))) fadeStyle(&cell.style, th.fg, th.bg, palette, amount, &memo);
};
if (focused) return;
const tag = &s.tag_layers[id];
- if (tag.rows != 0) for (tag.cells[0..@as(usize, tag.cols) * tag.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, tag.bg, palette, amount, &memo);
+ if (tag.rows != 0) for (tag.cells[0 .. @as(usize, tag.cols) * tag.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, tag.bg, palette, amount, &memo);
for (0..Pane.Notices.max) |i| {
const notice = &s.tag_layers[NOTICE_LAYER_BASE + id * Pane.Notices.max + i];
- if (notice.rows != 0) for (notice.cells[0..@as(usize, notice.cols) * notice.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, notice.bg, palette, amount, &memo);
+ if (notice.rows != 0) for (notice.cells[0 .. @as(usize, notice.cols) * notice.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, notice.bg, palette, amount, &memo);
}
}
@@ -978,7 +978,12 @@ pub fn paintHeaders(p: *Pardes, s: *Surface, arena: std.mem.Allocator) !void {
if (s.region(.workspace_tag, Region.none)) |region| {
const top = if (p.header_focus and p.header_column == null) p.header_top else 0;
const layer = &s.tag_layers[MAX_PANES + MAX_COLS];
- try renderHeaderLayer(p, arena, layer, .workspace, 0, region.rect, tagline.topbar(p), top, chrome.tag_bg, chrome.tag_fg);
+ var viewport = region.rect;
+ const inset = @min(TAG_TEXT_INSET, viewport.w);
+ s.fill(viewport.x, viewport.y, inset, viewport.h, .{ .bg = .{ .rgb = chrome.tag_bg }, .fg = .{ .rgb = chrome.tag_fg }, .font_role = .tagline });
+ viewport.x += inset;
+ viewport.w -= inset;
+ try renderHeaderLayer(p, arena, layer, .workspace, 0, viewport, tagline.topbar(p), top, chrome.tag_bg, chrome.tag_fg);
joinHeaderRows(s, layer, chrome.tag_fg);
}
const column_rows = p.columnBarHeight();
@@ -1348,8 +1353,7 @@ pub fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pa
const at = modal.positionAt(shown.text, shown.fromReal(@intCast(@max(0, pane.input.cur_col))));
if (at.row < top or at.row >= top + rows) break :caret null;
break :caret .{ .row = at.row - top, .at = @min(lines[at.row - top].len, at.col) };
- }
- else if (pane.focus == .tag and pane.prompt == .none) caret: {
+ } else if (pane.focus == .tag and pane.prompt == .none) caret: {
const real = modal.offsetAt(whole, .{ .row = @intCast(@max(0, pane.tag.cur_row)), .col = @intCast(@max(0, pane.tag.cur_col)) });
const at = modal.positionAt(shown.text, shown.fromReal(real));
if (at.row < top or at.row >= top + rows) break :caret null;
@@ -2392,7 +2396,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o
// The file's first glyph's ink, in whichever form its body has.
fn of(s: *const Surface) [3]u8 {
const body = &s.body_layers[0];
- const cells = if (body.rows != 0) body.cells[0..@as(usize, body.cols) * body.rows] else s.cells;
+ const cells = if (body.rows != 0) body.cells[0 .. @as(usize, body.cols) * body.rows] else s.cells;
for (cells) |cell| if (!cell.default and cell.len == 1 and cell.text[0] == 's' and cell.style.font_role == .body) return switch (cell.style.fg) {
.rgb => |rgb| rgb,
else => .{ 0, 0, 0 },