cut
Parameters
- self:*TextEntryWidget
- *TextEntryWidget
Source
Implementation
pub fn cut(self: *TextEntryWidget) void {
var sel = self.textLayout.selectionGet(self.len);
if (!sel.empty()) {
// copy selection to clipboard
dvui.clipboardTextSet(self.text[sel.start..sel.end]);
// delete selection
self.textChangedRemoved(sel.start, sel.end);
@memmove(self.text[sel.start..][0 .. self.len - sel.end], self.text[sel.end..self.len]);
self.setLen(self.len - (sel.end - sel.start));
sel.end = sel.start;
sel.cursor = sel.start;
self.textLayout.scroll_to_cursor = true;
}
}