diff options
Diffstat (limited to 'core/draw.zig')
| -rw-r--r-- | core/draw.zig | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/core/draw.zig b/core/draw.zig index 2553d5be..c156352f 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -152,6 +152,12 @@ pub fn place(p: *Pardes, s: *Surface) void { } } const column_rows = layout.columnBarHeight(p); + // A lone column's tag at the window row's left (UX K'2): no grip, a + // column's edge has nothing to be dragged against. + if (layout.columnInWindowRow(p)) { + const inset = @min(TAG_TEXT_INSET, v.screen_w); + s.addRegion(.{ .kind = .column_tag, .owner = 0, .serial = v.cols[0].serial, .active = layout.findPane(p, v.active) != null, .rect = .{ .x = inset, .y = 0, .w = tagline.windowRow(p).column, .h = p.topBarHeight() } }); + } if (column_rows > 0) for (0..p.view().ncol) |c| { if (v.col_w[c] == 0) continue; const active = if (layout.findPane(p, v.active)) |found| found.col == c else false; @@ -583,25 +589,31 @@ fn paintHeaders(p: *Pardes, s: *Surface) !void { if (s.region(.workspace_tag, Region.none)) |region| { const top = if (v.header != null and p.headerColumn() == null) v.header_top else 0; const layer = &s.tag_layers[MAX_PANES + MAX_COLS]; - var viewport = region.rect; - s.chrome.tagline_rows = @intCast(viewport.y + viewport.h); - const inset = @min(TAG_TEXT_INSET, viewport.w); - s.fill(viewport.x, viewport.y, inset, viewport.h, .{ .bg = .{ .rgb = chrome.tagline_bg }, .fg = .{ .rgb = chrome.tagline_fg }, .font_role = .tagline }); - viewport.x += inset; - viewport.w -= inset; - try renderHeaderLayer(p, layer, .workspace, 0, viewport, tagline.topbar(p), top, chrome.tagline_bg, chrome.tagline_fg); + s.chrome.tagline_rows = @intCast(region.rect.y + region.rect.h); + // The window row (UX K'2), on the tagline's ground end to end: a + // lone column's tag at its left (its region), in the row's inks; + // the window's at its right end (tagline.windowRow). + s.fill(region.rect.x, region.rect.y, region.rect.w, region.rect.h, .{ .bg = .{ .rgb = chrome.tagline_bg }, .fg = .{ .rgb = chrome.tagline_fg }, .font_role = .tagline }); + if (s.region(.column_tag, 0)) |column| if (column.rect.y < region.rect.y + region.rect.h) { + const column_top = if (v.header != null and p.headerColumn() == 0) v.header_top else 0; + const column_layer = &s.tag_layers[MAX_PANES]; + try renderHeaderLayer(p, column_layer, .column, 0, column.rect, tagline.columnTag(p, 0), column_top, chrome.tagline_bg, chrome.tagline_fg); + joinHeaderRows(s, column_layer, chrome.tagline_fg); + }; + const words = tagline.windowRow(p).words; + const viewport: Rect = .{ .x = words, .y = region.rect.y, .w = region.rect.w -| words, .h = region.rect.h }; + const text = tagline.topbar(p); + try renderHeaderLayer(p, layer, .workspace, 0, viewport, text, top, chrome.tagline_bg, chrome.tagline_fg); // A server's progress (a message of no pane) at its first row's // right end, where the row has room for it. - if (layer.rows > 0 and top == 0) for (p.messages.live[0..p.messages.live_len]) |*said| { - if (said.kind != .progress or said.pane != 0) continue; + if (layer.rows > 0 and top == 0) if (tagline.sessionProgress(p)) |said| { var buf: [Messages.LoggedMessage.cap + 8]u8 = undefined; - const text = std.fmt.bufPrint(&buf, "{s} {s}", .{ Messages.Kind.progress.glyph(), said.words() }) catch break; - const width = panes.File.displayWidth(p.settings.tab, text); - const used = panes.File.displayWidth(p.settings.tab, modal.lineSlice(tagline.topbar(p), 0)); + const shown = std.fmt.bufPrint(&buf, "{s} {s}", .{ Messages.Kind.progress.glyph(), said.words() }) catch ""; + const width = panes.File.displayWidth(p.settings.tab, shown); + const used = panes.File.displayWidth(p.settings.tab, modal.lineSlice(text, 0)); const room = layout.tagCapacity(p, viewport.w); var row: Surface = .{ .cols = layer.cols, .rows = 1, .cells = layer.cells[0..layer.cols], .tab = p.settings.tab }; - if (used + 2 + width < room) _ = row.print(@intCast(room - 1 - width), 0, @intCast(width), text, .{ .fg = .{ .rgb = Messages.ink(chrome, .progress) }, .bg = .{ .rgb = chrome.tagline_bg }, .font_role = .tagline }); - break; + if (used + 2 + width < room) _ = row.print(@intCast(room - 1 - width), 0, @intCast(width), shown, .{ .fg = .{ .rgb = Messages.ink(chrome, .progress) }, .bg = .{ .rgb = chrome.tagline_bg }, .font_role = .tagline }); }; joinHeaderRows(s, layer, chrome.tagline_fg); } |
