From 1dba2b6c70f7ada2e060db2e84f95f67d3007c0e Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 23 Jan 2025 20:46:52 +0800 Subject: [PATCH] input: Fix mouse click to position cursor to before of the char. (#572) --- crates/ui/src/input/input.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/input/input.rs b/crates/ui/src/input/input.rs index 7b88b73c..1e8daf3b 100644 --- a/crates/ui/src/input/input.rs +++ b/crates/ui/src/input/input.rs @@ -776,9 +776,9 @@ impl TextInput { } if event.modifiers.shift { - self.select_to(self.next_boundary(offset), cx); + self.select_to(self.previous_boundary(offset), cx); } else { - self.move_to(self.next_boundary(offset), cx) + self.move_to(self.previous_boundary(offset), cx) } } @@ -1168,7 +1168,7 @@ impl TextInput { } let offset = self.index_for_mouse_position(event.position, cx); - self.select_to(self.next_boundary(offset), cx); + self.select_to(self.previous_boundary(offset), cx); } fn is_valid_input(&self, new_text: &str) -> bool {