╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ widget.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1414 text_input.options.label = choice.label; 1415 text_input.options.bottom_label = choice.bottom_label; 1416 try text_input.setContent(allocator, choice.text); 1417 } 1418 1419 fn show(self: *CopyableText) void { 1420 const choice = self.choices[self.selected]; 1421 self.session.host_request = .{ .show_copyable_text = choice.copyable_text orelse choice.text }; 1422 } 1423 1424 fn textInput(self: *CopyableText) *wgt.TextInput { 1425 return &self.box.children.values()[if (self.choices.len > 1) self.choices.len else 0].widget.text_input; 1426 } 1427 1428 fn selector(self: *CopyableText, index: usize) *wgt.TextBox { 1429 return &self.box.children.values()[index].widget.text_box; 1430 } 1431 1432 fn maxWidth(choices: []const Choice) usize { 1433 var width: usize = 0; 1434 for (choices) |choice| width = @max(width, choice.text.len, choice.label.len, choice.bottom_label.len); 1435 return width; 1436 } 1437 1438 pub fn clearGrid(self: *CopyableText) void { 1439 self.box.clearGrid(); 1440 } 1441 1442 pub fn getGrid(self: CopyableText) ?Grid { 1443 return self.box.getGrid(); 1444 } 1445 1446 pub fn getFocus(self: *CopyableText) *Focus { 1447 return self.box.getFocus(); 1448 } 1449 }; 1450