fix: allow cut to cut to end of the document

closes #165
This commit is contained in:
CJ van den Berg 2025-02-04 20:33:36 +01:00
parent 9ce90154c6
commit 1764b3259c
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2351,8 +2351,14 @@ pub const Editor = struct {
if (primary.selection) |_| {} else {
const sel = primary.enable_selection(root, self.metrics) catch return;
try move_cursor_begin(root, &sel.begin, self.metrics);
try move_cursor_end(root, &sel.end, self.metrics);
try move_cursor_right(root, &sel.end, self.metrics);
move_cursor_end(root, &sel.end, self.metrics) catch |e| switch (e) {
error.Stop => {},
else => return e,
};
move_cursor_right(root, &sel.end, self.metrics) catch |e| switch (e) {
error.Stop => {},
else => return e,
};
};
var first = true;
var text = std.ArrayList(u8).init(self.allocator);