╭ changed ──────────────╮ │src/ui/Repo/Comment.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │141 │ │142 const metadata_index: usize = 0; │ │143 const body_index: usize = 1; │ │144 + const gap_index: usize = 2; │ │145 + const metadata_first_link_index: usize = 1; │ │146 │ │147 pub fn init(allocator: std.mem.Allocator, session: *ui.Session, identity: []const u8, entry: CommentWithId) !Item {│ │148 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │151 { │ │152 var bar = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │153 errdefer bar.deinit(allocator); │ │154 + │ │155 + var spacer = try ui.Spacer.init(allocator); │ │156 + errdefer spacer.deinit(allocator); │ │157 + try bar.children.put(allocator, spacer.getFocus().id, .{ .widget = .{ .spacer = spacer }, .rect = null, .min_size = null });│ │158 │ │159 var author = try ui.authorBox(allocator, session.page_arena, entry.author); │ │160 errdefer author.deinit(allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │190 try bar.children.put(allocator, parent.getFocus().id, .{ .widget = .{ .text_box = parent }, .rect = null, .min_size = .{ .width = @max(parent_text.len, " replying to ".len) + 2, .height = null } });│ │191 } │ │192 │ │187 - bar.getFocus().child_id = bar.children.keys()[0]; │ │193 + bar.getFocus().child_id = bar.children.keys()[metadata_first_link_index]; │ │194 try box.children.put(allocator, bar.getFocus().id, .{ .widget = .{ .box = bar }, .rect = null, .min_size = null }); │ │195 } │ │196 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │199 errdefer body_box.deinit(allocator); │ │200 body_box.getFocus().focusable = true; │ │201 try box.children.put(allocator, body_box.getFocus().id, .{ .widget = .{ .text_box = body_box }, .rect = null, .min_size = null });│ │202 + │ │203 + var gap = try wgt.Text(ui.Widget).init(allocator, ""); │ │204 + errdefer gap.deinit(allocator); │ │205 + try box.children.put(allocator, gap.getFocus().id, .{ .widget = .{ .text = gap }, .rect = null, .min_size = null }); │ │206 + │ │207 box.getFocus().child_id = box.children.keys()[metadata_index]; │ │208 │ │209 return .{ .box = box }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │223 │ │224 pub fn focusMetadata(self: *Item, root_focus: *Focus) void { │ │225 const bar = self.metadata(); │ │215 - root_focus.setFocus(bar.getFocus().child_id orelse bar.children.keys()[0]); │ │226 + root_focus.setFocus(bar.getFocus().child_id orelse bar.children.keys()[metadata_first_link_index]);│ │227 } │ │228 │ │229 pub fn focusBody(self: *Item, root_focus: *Focus) void { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ │236 const selected = bar.getFocus().child_id orelse return false; │ │237 const selected_index = bar.children.getIndex(selected) orelse return false; │ │238 const target = if (right) selected_index + 1 else selected_index -| 1; │ │228 - if (target == selected_index or target >= bar.children.count()) return false; │ │239 + if (target < metadata_first_link_index or target >= bar.children.count()) return false;│ │240 root_focus.setFocus(bar.children.keys()[target]); │ │241 return true; │ │242 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │243 │ │244 pub fn rowRect(self: *Item, body_row: bool) ?layout.IRect { │ │234 - return self.box.children.values()[if (body_row) body_index else metadata_index].rect; │ │245 + if (!body_row) return self.box.children.values()[metadata_index].rect; │ │246 + var rect = self.box.children.values()[body_index].rect orelse return null; │ │247 + if (self.box.children.values()[gap_index].rect) |gap| rect.size.height += gap.size.height;│ │248 + return rect; │ │249 } │ │250 │ │251 pub fn deinit(self: *Item, allocator: std.mem.Allocator) void { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯