╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │702 try box.children.put(allocator, list_scroll.getFocus().id, .{ .widget = .{ .scroll = list_scroll }, .rect = null, .min_size = .{ .width = list_max_width, .height = null }, .max_size = .{ .width = list_max_width, .height = null } });│ │703 } │ │704 │ │705 - // the detail pane — a frame around a scroll of the description │ │705 + // the detail pane — a frame around its scrollable contents │ │706 { │ │707 var detail_outer = blk: { │ │708 var detail_scroll = blk2: { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │715 errdefer detail_scroll.deinit(allocator); │ │716 var frame = try wgt.Box(Widget).init(allocator, .{ .border_style = .hidden, .direction = .vert }); │ │717 errdefer frame.deinit(allocator); │ │718 - // the tool row sits above the scroll (populateDetail fills │ │719 - // it per thread). │ │720 - { │ │721 - var row = try wgt.Box(Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │722 - errdefer row.deinit(allocator); │ │723 - try frame.children.put(allocator, row.getFocus().id, .{ .widget = .{ .box = row }, .rect = null, .min_size = null }); │ │724 - } │ │718 // the frame's selected child is its scroll, so the focus chain │ │726 - // reaches the description (populateDetail points the scroll's │ │727 - // inner box at it), letting focus recovery descend into the pane. │ │719 + // reaches the detail contents. │ │720 frame.getFocus().child_id = detail_scroll.getFocus().id; │ │721 try frame.children.put(allocator, detail_scroll.getFocus().id, .{ .widget = .{ .scroll = detail_scroll }, .rect = null, .min_size = null });│ │722 break :blk frame; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │1099 return &self.listScroll(index).child.box; │ │1100 } │ │1101 │ │1110 - // the detail frame's children: the tool row above the scroll pane. │ │1102 + // the tool row is the first child inside the detail scroll. │ │1103 const tool_row_index: usize = 0; │ │1112 - const detail_scroll_index: usize = 1; │ │1104 + const detail_scroll_index: usize = 0; │ │1105 │ │1106 fn detailOuter(self: *This, index: usize) *wgt.Box(Widget) { │ │1107 return &self.resultsBox(index).children.values()[detail_index].widget.box;│ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │1108 } │ │1109 │ │1110 fn toolRow(self: *This, index: usize) *wgt.Box(Widget) { │ │1119 - return &self.detailOuter(index).children.values()[tool_row_index].widget.box;│ │1111 + return &self.detailInner(index).children.values()[tool_row_index].widget.box;│ │1112 } │ │1113 │ │1114 fn detailScroll(self: *This, index: usize) *wgt.Scroll(Widget) { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1247 self.title_id[index] = null; │ │1248 self.author_id[index] = null; │ │1249 │ │1258 - // the tool row; the description page shows none. │ │1250 + // the tool row is part of the scroll; the description and comment │ │1251 + // pages leave it empty. │ │1252 { │ │1260 - const row = self.toolRow(index); │ │1261 - for (row.children.values()) |*child| child.widget.deinit(allocator); │ │1262 - row.children.clearAndFree(allocator); │ │1263 - row.getFocus().child_id = null; │ │1264 - row.getFocus().kind = .container; │ │1253 + var row = try wgt.Box(Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │1254 + errdefer row.deinit(allocator); │ │1255 + try inner.children.put(allocator, row.getFocus().id, .{ .widget = .{ .box = row }, .rect = null, .min_size = null });│ │1256 } │ │1257 if (!description_page and comment_page == null) { │ │1258 const row = self.toolRow(index); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1346 errdefer spacer.deinit(allocator); │ │1347 try inner.children.put(allocator, spacer.getFocus().id, .{ .widget = .{ .spacer = spacer }, .rect = null, .min_size = null });│ │1348 │ │1358 - inner.getFocus().child_id = inner.children.keys()[0]; │ │1349 + inner.getFocus().child_id = inner.children.keys()[tool_row_index + 1]; │ │1350 const sc = self.detailScroll(index); │ │1351 sc.x = 0; │ │1352 sc.y = 0; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │1431 }; │ │1432 │ │1433 if (supports_drafts and entryDraft(entry)) { │ │1443 - inner.getFocus().child_id = inner.children.keys()[0]; │ │1434 + inner.getFocus().child_id = inner.children.keys()[tool_row_index + 1];│ │1435 const sc = self.detailScroll(index); │ │1436 sc.x = 0; │ │1437 sc.y = 0; │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │1574 self.commentInput(index, key, root_focus); │ │1575 return; │ │1576 } │ │1586 - if (self.toolRowFocused(index)) { │ │1577 + if (self.toolRowFocused(index, root_focus)) { │ │1578 try self.toolRowInput(allocator, index, key, root_focus);│ │1579 return; │ │1580 } │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1657 .arrow_left => if (cur > first_in_row_index) root_focus.setFocus(row.children.keys()[cur - 1]) else self.focusList(index, root_focus),│ │1658 .arrow_right => if (cur + 1 < row.children.count()) root_focus.setFocus(row.children.keys()[cur + 1]), │ │1659 .arrow_up => self.focusHeader(root_focus), │ │1669 - .arrow_down => { │ │1670 - self.focusDetailEdge(index, root_focus, false); │ │1671 - self.detailScroll(index).y = 0; │ │1672 - }, │ │1660 + .arrow_down => _ = self.moveDetailVertical(index, root_focus, true), │ │1661 .enter => if (on_primary) try self.primaryAction(allocator, index), │ │1662 .mouse => |mouse| if (on_primary and inp.leftClickOn(root_focus, child_id, mouse)) try self.primaryAction(allocator, index), │ │1663 else => {}, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1862 if (last) comment.focusBody(root_focus) else comment.focusMetadata(root_focus);│ │1863 }, │ │1864 .box => |*box| if (box.children.count() > 0) { │ │1877 - target = box.children.keys()[if (last) box.children.count() - 1 else 0]; │ │1865 + target = if (child_index == tool_row_index) │ │1866 + box.getFocus().child_id orelse return │ │1867 + else │ │1868 + box.children.keys()[if (last) box.children.count() - 1 else 0]; │ │1869 root_focus.setFocus(target); │ │1870 }, │ │1871 else => root_focus.setFocus(target), │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯