╭ changed ────────────╮ │src/ui/Repo/Files.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │378 │ │379 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz });│ │380 errdefer box.deinit(allocator); │ │381 + │ │382 + var shows_file = false; │ │383 │ │384 // the directory listing on the left (one focusable row each). │ │385 { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │423 const entry_idx = selectedFileIndex(data) orelse if (data.find == null) readmeIndex(data.entries) else null; │ │424 sel = if (entry_idx) |i| i + base else 0; │ │425 list_box.getFocus().child_id = list_box.children.keys()[sel]; │ │426 + shows_file = sel >= base and sel - base < data.entries.len and !data.entries[sel - base].is_dir; │ │427 } │ │428 var sc = try wgt.Scroll(ui.Widget).init(allocator, .{ .box = list_box }, .{ .direction = .vert, .web_native = !session.is_terminal, .fill = true });│ │429 // start scrolled so the selected row begins at the top of the │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │486 try box.children.put(allocator, detail_outer.getFocus().id, .{ .widget = .{ .box = detail_outer }, .rect = null, .min_size = .{ .width = detail_min_width, .height = null } });│ │487 } │ │488 │ │486 - box.getFocus().child_id = box.children.keys()[list_index]; │ │489 + box.getFocus().child_id = box.children.keys()[if (shows_file) detail_index else list_index]; │ │490 try outer.children.put(allocator, box.getFocus().id, .{ .widget = .{ .box = box }, .rect = null, .min_size = null }); │ │491 │ │492 // focus lives in the split, except that search results start in the │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯