╭ changed ───────────╮ │src/ui/Repo/Refs.zig│ ╰────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │48 .branches = .{ .label = try ui.SubTitle.init(arena, "branches") }, │ │49 .tags = .{ .label = try ui.SubTitle.init(arena, "tags") }, │ │50 }; │ │51 +} │ │52 + │ │53 +// both columns empty with no previous row, which shows the empty message │ │54 +fn isEmpty(self: *const Self) bool { │ │55 + return self.branches.names.len == 0 and self.branches.prev == null and self.tags.names.len == 0 and self.tags.prev == null;│ │56 } │ │57 │ │58 // read one window of each column from an opened repo. the ref names are duped │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │182 try outer.children.put(allocator, header.getFocus().id, .{ .widget = .{ .box = header }, .rect = null, .min_size = .{ .width = null, .height = 4 } });│ │183 } │ │184 │ │180 - { │ │185 + // with both columns empty, the empty message stands in for them │ │186 + if (data.isEmpty()) { │ │187 + var center = try ui.widget.initEmpty(allocator); │ │188 + errdefer center.deinit(allocator); │ │189 + try outer.children.put(allocator, center.getFocus().id, .{ .widget = .{ .center = center }, .rect = null, .min_size = null }); │ │190 + } else { │ │191 var split = try wgt.Box(ui.Widget).init(allocator, .{ .border = null, .direction = .horiz }); │ │192 errdefer split.deinit(allocator); │ │193 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │276 │ │277 // split the available width evenly between the two columns when it's│ │278 // known; otherwise let them size to their content. │ │269 - if (constraint.max_size.width) |w| { │ │270 - const half = w / 2; │ │271 - for (self.columns().children.values()) |*child| { │ │272 - child.min_size = .{ .width = half, .height = null }; │ │273 - child.max_size = .{ .width = half, .height = null }; │ │274 - } │ │275 - } else { │ │276 - for (self.columns().children.values()) |*child| { │ │277 - child.min_size = null; │ │278 - child.max_size = null; │ │279 + if (!self.data.isEmpty()) { │ │280 + if (constraint.max_size.width) |w| { │ │281 + const half = w / 2; │ │282 + for (self.columns().children.values()) |*child| { │ │283 + child.min_size = .{ .width = half, .height = null }; │ │284 + child.max_size = .{ .width = half, .height = null }; │ │285 + } │ │286 + } else { │ │287 + for (self.columns().children.values()) |*child| { │ │288 + child.min_size = null; │ │289 + child.max_size = null; │ │290 + } │ │291 } │ │292 } │ │293 │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │302 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │303 if (self.headerActive()) { │ │304 const search_box = self.searchBox(); │ │293 - if (inp.vertDirection(key) == .down) return root_focus.setFocus(self.columns().getFocus().id);│ │305 + if (inp.vertDirection(key) == .down) { │ │306 + // the empty message has nothing to focus │ │307 + if (!self.data.isEmpty()) root_focus.setFocus(self.columns().getFocus().id); │ │308 + return; │ │309 + } │ │310 if (key == .enter) { │ │311 const text = try search_box.text(allocator); │ │312 defer allocator.free(text); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯