fix: don't allow double click to fail if select_word_at_cursor fails

This commit is contained in:
CJ van den Berg 2025-12-28 21:18:18 +01:00
parent e23d35b8c7
commit 3de4a47123
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2623,8 +2623,9 @@ pub const Editor = struct {
primary.disable_selection(root, self.metrics); primary.disable_selection(root, self.metrics);
self.selection_mode = .word; self.selection_mode = .word;
primary.cursor.move_abs(root, &self.view, @intCast(y), @intCast(x), self.metrics) catch return; primary.cursor.move_abs(root, &self.view, @intCast(y), @intCast(x), self.metrics) catch return;
_ = try self.select_word_at_cursor(primary); self.selection_drag_initial = self.select_word_at_cursor(primary) catch |e| switch (e) {
self.selection_drag_initial = primary.selection; error.Stop => primary.to_selection_normal(),
};
self.collapse_cursors(); self.collapse_cursors();
self.clamp_mouse(); self.clamp_mouse();
} }