╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ widget.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1381 const choice = self.choices[self.selected]; 1382 self.session.host_request = .{ .show_copyable_text = choice.copyable_text orelse choice.text }; 1383 } 1384 1385 fn textInput(self: *CopyableText) *wgt.TextInput { 1386 return &self.box.children.values()[if (self.choices.len > 1) self.choices.len else 0].widget.text_input; 1387 } 1388 1389 fn selector(self: *CopyableText, index: usize) *wgt.TextBox { 1390 return &self.box.children.values()[index].widget.text_box; 1391 } 1392 1393 fn maxWidth(choices: []const Choice) usize { 1394 var width: usize = 0; 1395 for (choices) |choice| width = @max(width, choice.text.len, choice.label.len, choice.bottom_label.len); 1396 return width; 1397 } 1398 1399 pub fn clearGrid(self: *CopyableText) void { 1400 self.box.clearGrid(); 1401 } 1402 1403 pub fn getGrid(self: CopyableText) ?Grid { 1404 return self.box.getGrid(); 1405 } 1406 1407 pub fn getFocus(self: *CopyableText) *Focus { 1408 return self.box.getFocus(); 1409 } 1410 }; 1411