diff options
Diffstat (limited to 'core/draw.zig')
| -rw-r--r-- | core/draw.zig | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/core/draw.zig b/core/draw.zig index e90535b5..42396aa1 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; @@ -538,7 +544,14 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: // painted out. Text gets the overlay; a kind's pane gives up the rows. const shown = pane.notices.span(); const body_h = (r.h -| pane.tag_rows) -| shown; - pardes.Kind.draw(p, s, arena, pane, id, tx, body_y + shown, tw, body_h); + // A picker's preview through a kind (Pick.showKind): its file named + // until its kind has drawn it. + if (!pardes.Kind.draw(p, s, arena, pane, id, tx, body_y + shown, tw, body_h) and body_h > 0 and pardes.Pick.previewing(p, id)) { + const k = pane.addon.?; + if (pardes.Pick.nameLine(arena, k.path, k.nameOf(), k.size, "")) |line| { + _ = s.print(tx, body_y + shown, tw, line, .{ .fg = if (th.fg) |c| .{ .rgb = c } else .default, .bg = pane_bg }); + } else |_| {} + } // The same one column as the real scrollbar below, running past // the notice bands so the gutter has no notch in it; its thumb // where this frame's paint said its window is in its whole (a @@ -588,25 +601,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); } @@ -926,6 +945,9 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R const ground = groundOf(p, pane, active); const inks = chrome.roles.on(ground); const selected = chrome.roles.selectedOn(ground); + // A symbol's kind mark (colors.Chrome.Inks.kind): held on this tag's + // ground and on its cursor row's selection. + const kind = p.chrome().on(if (active) .focus else .plain).kind; const bg = inks.ground; const fg = inks.text; const storage = try arena.alloc(Cell, @as(usize, columns) * rows); @@ -970,6 +992,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R if (b < part.row.chord) style.fg = .{ .rgb = chrome.roles.key }; if (b < part.row.pre) style.fg = .{ .rgb = if (active) chrome.tag_active_name_fg else chrome.tag_name_fg }; if (part.row.dim or (b >= part.row.pre and b < part.row.pre + part.row.faint) or (b >= part.row.quiet[0] and b < part.row.quiet[1])) style.fg = .{ .rgb = on.dim }; + if (b < part.row.kind) style.fg = .{ .rgb = kind }; for (part.row.keys) |k| if (k == b) { style.fg = .{ .rgb = chrome.roles.key }; style.bold = true; |
