input: Fix mouse click to position cursor to before of the char. (#572)

This commit is contained in:
Jason Lee 2025-01-23 20:46:52 +08:00 committed by GitHub
parent 77badb5799
commit 1dba2b6c70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -776,9 +776,9 @@ impl TextInput {
} }
if event.modifiers.shift { if event.modifiers.shift {
self.select_to(self.next_boundary(offset), cx); self.select_to(self.previous_boundary(offset), cx);
} else { } 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); 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 { fn is_valid_input(&self, new_text: &str) -> bool {