fix: prevent empty selection on double click ot of bounds

This commit is contained in:
CJ van den Berg 2024-03-10 21:04:00 +01:00
parent 1b8e61dc7a
commit b87e1a867b

View file

@ -2435,6 +2435,7 @@ pub const Editor = struct {
fn select_word_at_cursor(self: *Self, cursel: *CurSel) !*Selection {
const root = try self.buf_root();
const sel = cursel.enable_selection();
defer cursel.check_selection();
sel.normalize();
try move_cursor_word_begin(root, &sel.begin);
try move_cursor_word_end(root, &sel.end);