╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ widget.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
2242 const text_input = self.textInput(); 2243 text_input.options.top_label.text = choice.label; 2244 text_input.options.bottom_label.text = choice.bottom_label; 2245 try text_input.setContent(allocator, choice.text); 2246 } 2247 2248 fn show(self: *CopyableText) void { 2249 const choice = self.choices[self.selected]; 2250 self.session.host_request = .{ .show_copyable_text = choice.copyable_text orelse choice.text }; 2251 } 2252 2253 fn textInput(self: *CopyableText) *wgt.TextInput { 2254 return &self.box.children.values()[if (self.choices.len > 1) self.choices.len else 0].widget.text_input; 2255 } 2256 2257 fn selector(self: *CopyableText, index: usize) *wgt.TextBox { 2258 return &self.box.children.values()[index].widget.text_box; 2259 } 2260 2261 fn maxWidth(choices: []const Choice) usize { 2262 var width: usize = 0; 2263 for (choices) |choice| width = @max(width, choice.text.len, choice.label.len, choice.bottom_label.len); 2264 return width; 2265 } 2266 2267 pub fn clearGrid(self: *CopyableText) void { 2268 self.box.clearGrid(); 2269 } 2270 2271 pub fn getGrid(self: CopyableText) ?Grid { 2272 return self.box.getGrid(); 2273 } 2274 2275 pub fn getFocus(self: *CopyableText) *Focus { 2276 return self.box.getFocus(); 2277 } 2278 }; 2279