╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │275 │ │276 const list_index: usize = 0; │ │277 const diff_index: usize = 1; │ │278 - // min widths for the two panes │ │279 - const list_width: usize = 40; │ │280 - const diff_width: usize = 40; │ │278 + const list_max_width: usize = 40; │ │279 + const diff_min_width: usize = 40; │ │280 // how many rows a page up/down jumps, and the scroll-wheel step.│ │281 const page_rows = 10; │ │282 │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │283 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View { │ │285 - const aa = session.page_arena.allocator(); │ │286 - │ │284 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz });│ │285 errdefer box.deinit(allocator); │ │286 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │290 var list_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ │291 errdefer list_box.deinit(allocator); │ │292 for (data.commits) |commit| { │ │296 - const label = try std.fmt.allocPrint(aa, "{s} {s}", .{ commit.date, commit.message }); │ │297 - try addRow(allocator, &list_box, label, ""); │ │293 + try addRow(allocator, &list_box, commit.message, ""); │ │294 } │ │295 if (data.next_start) |next| { │ │296 try addRow(allocator, &list_box, "next", try commitsPageLink(session.page_arena, data.identity, next));│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │299 break :blk try wgt.Scroll(ui.Widget).init(allocator, .{ .box = list_box }, .{ .direction = .vert }); │ │300 }; │ │301 errdefer list_scroll.deinit(allocator); │ │306 - try box.children.put(allocator, list_scroll.getFocus().id, .{ .widget = .{ .scroll = list_scroll }, .rect = null, .min_size = .{ .width = list_width, .height = null } }); │ │302 + 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 } });│ │303 } │ │304 │ │305 // the diff pane — a frame around a scroll of the hunks │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │317 break :blk outer; │ │318 }; │ │319 errdefer diff_outer.deinit(allocator); │ │324 - try box.children.put(allocator, diff_outer.getFocus().id, .{ .widget = .{ .box = diff_outer }, .rect = null, .min_size = .{ .width = diff_width, .height = null } }); │ │320 + try box.children.put(allocator, diff_outer.getFocus().id, .{ .widget = .{ .box = diff_outer }, .rect = null, .min_size = .{ .width = diff_min_width, .height = null } });│ │321 } │ │322 │ │323 box.getFocus().child_id = box.children.keys()[list_index]; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │334 } │ │335 │ │336 fn addRow(allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), label: []const u8, link: []const u8) !void { │ │341 - var row = try wgt.TextBox(ui.Widget).init(allocator, label, .{ .border_style = .hidden, .rounded_corners = true, .wrap_kind = .none });│ │337 + var row = try wgt.TextBox(ui.Widget).init(allocator, label, .{ .border_style = .hidden, .rounded_corners = true, .wrap_kind = .word });│ │338 errdefer row.deinit(allocator); │ │339 row.getFocus().focusable = true; │ │340 if (link.len != 0) row.getFocus().kind = .{ .custom = link }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │345 - try box.children.put(allocator, row.getFocus().id, .{ .widget = .{ .text_box = row }, .rect = null, .min_size = null }); │ │341 + try box.children.put(allocator, row.getFocus().id, .{ .widget = .{ .text_box = row }, .rect = null, .min_size = null, .max_size = .{ .width = null, .height = 5 } });│ │342 } │ │343 │ │344 // one hunk as a focusable multi-line text box. its lines sit flush (the │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │443 else => {}, │ │444 } │ │445 } │ │446 + │ │447 + // cap the list at list_max_width only while the diff pane fits beside it. │ │448 + // the box drops the diff when the width can't hold both minimums, so when │ │449 + // it's that narrow we lift the cap and let the list fill the whole width. │ │450 + const both_panes_fit = if (constraint.max_size.width) |w| w >= list_max_width + diff_min_width else true; │ │451 + self.box.children.values()[list_index].max_size = if (both_panes_fit) .{ .width = list_max_width, .height = null } else null;│ │452 │ │453 // web browsers provide scrolling, so let every widget grow to │ │454 // its natural size instead of clipping inside the diff scroll │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯