╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │1955 return &self.viewStack().children.values()[tags_view_index].tag_flow; │ │1956 } │ │1957 │ │1958 - // the new-thread, edit, or resolve form inside the stack, or null when the│ │1959 - // unauthorized view stands in for it. │ │1960 - fn threadForm(self: *This) ?*wgt.Box(Widget) { │ │1958 + // the non-confirmation form inside the stack │ │1959 + fn formBox(self: *This) ?*wgt.Box(Widget) { │ │1960 return switch (self.viewStack().children.values()[form_view_index]) { │ │1961 .box => |*box| box, │ │1962 // the resolve form sits inside a scroll on the terminal │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────╮ │1963 .scroll => |*scroll| &scroll.child.box,│ │1964 + else => null, │ │1965 + }; │ │1966 + } │ │1967 + │ │1968 + fn threadForm(self: *This) ?*wgt.Box(Widget) { │ │1969 + return switch (self.data.view) { │ │1970 + .new, .edit => self.formBox(), │ │1971 else => null, │ │1972 }; │ │1973 } │ ╰─────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2111 const invalid_target = failure == .invalid_target_branch; │ │2112 form.children.values()[target_branch_field_index].widget.text_input.options.label = if (invalid_target) " target branch (not found) " else " target branch ";│ │2113 } │ │2114 + } │ │2115 + if (self.formBox()) |form| { │ │2116 const inputs_arena = self.session.arena.allocator(); │ │2117 for (form.children.values()) |*child| switch (child.widget) { │ │2118 .text_input => |*ti| try self.session.text_inputs.put(inputs_arena, ti.getFocus().id, ti), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2238 } │ │2239 │ │2240 fn commentFormInput(self: *This, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void {│ │2233 - const form = self.threadForm() orelse return; │ │2241 + const form = self.formBox() orelse return; │ │2242 const cid = form.getFocus().child_id orelse return; │ │2243 const cur = form.children.getIndex(cid) orelse return; │ │2244 const child = &form.children.values()[cur]; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2287 // move to; enter on a "use this" link is a navigation the host follows │ │2288 // before this runs. │ │2289 fn resolveInput(self: *This, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void {│ │2282 - const form = self.threadForm() orelse return; │ │2290 + const form = self.formBox() orelse return; │ │2291 const cid = form.getFocus().child_id orelse return; │ │2292 const cur = form.children.getIndex(cid) orelse return; │ │2293 const child = &form.children.values()[cur]; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │2376 const src = self.data.repo_source orelse return; │ │2377 const entry = self.data.selectedThread() orelse return; │ │2378 const author = (try self.session.eventAuthor()) orelse return; │ │2371 - const form = self.threadForm() orelse return; │ │2379 + const form = self.formBox() orelse return; │ │2380 │ │2381 // gather the inputs by name; the d<n> hunk inputs appear in chunk order│ │2382 var title: ?[]u8 = null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2439 const io = self.session.io orelse return; │ │2440 const src = self.data.repo_source orelse return; │ │2441 const author = (try self.session.eventAuthor()) orelse return; │ │2434 - const form = self.threadForm() orelse return; │ │2442 + const form = self.formBox() orelse return; │ │2443 const body_input = &form.children.values()[comment_body_field_index].widget.text_input;│ │2444 const body = try body_input.text(allocator); │ │2445 defer allocator.free(body); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯