editor: Fix sometimes green (+) cursor style appearing when cmd-clicking to navigate and back (#34557)

Regressed in https://github.com/zed-industries/zed/pull/33928

This PR clears the selection drag state when the editor focus is out.

To reproduce: 

1. Select some item in buffer that has a go to definition.
2. Cmd+Click mouse down on it, but don't let go.
3. Wait for 300ms+. 
4. Now cursor changed to green + (valid state, this is for selection
drag-n-drop).
5. Now let go of your mouse down, we switched to a different file.
Cursor looks normal.
6. Come back to the previous buffer, see green + cursor style (BUG!).

Release Notes:

- Fixed the issue where the green (+) cursor style sometimes appears
when navigating to the definition and then back to the previous buffer.
This commit is contained in:
Smit Barmase 2025-07-16 23:24:02 +05:30 committed by Joseph T. Lyons
parent cc5aaf765f
commit 43e2c92910

View file

@ -20467,6 +20467,7 @@ impl Editor {
if event.blurred != self.focus_handle {
self.last_focused_descendant = Some(event.blurred);
}
self.selection_drag_state = SelectionDragState::None;
self.refresh_inlay_hints(InlayHintRefreshReason::ModifiersChanged(false), cx);
}