From a792719dbef553fe2127e3f92d8f9f7253f89750 Mon Sep 17 00:00:00 2001 From: FlyingYu Date: Mon, 1 Dec 2025 11:06:40 +0800 Subject: [PATCH] editor: Fix cursor direction not resetting after mouse up (#1708) ## Description This PR fixes an issue where the editor's "reverse cursor" state was not reset after completing a text selection. Because the flag remained `true`, the cursor could appear on the wrong side of the selection when the next interaction started. ## Screenshot | Before | After | |--------|--------| | | | ## How to Test `cargo run --example editor` ## Checklist - [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and followed the guidelines. - [ ] Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate. - [x] Passed `cargo run` for story tests related to the changes. - [ ] Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) --- crates/ui/src/input/state.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui/src/input/state.rs b/crates/ui/src/input/state.rs index 35c358dd..239b28a7 100644 --- a/crates/ui/src/input/state.rs +++ b/crates/ui/src/input/state.rs @@ -1232,6 +1232,9 @@ impl InputState { _window: &mut Window, _cx: &mut Context, ) { + if self.selected_range.is_empty() { + self.selection_reversed = false; + } self.selecting = false; self.selected_word_range = None; }