Use click event to determine modifier keys (#22988)
Previously, editor elements had to listen for mouse_up events to determine when a click had completed. This meant that they only had access to modifier keys that were pressed during the mouse_up event. This led to some incorrect user experiences, such as executing a ctrl+click if the user pressed ctrl after pressing the mouse button, but before releasing it. This change adds a click event handler to EditorElement, and adds a modifier() method to the ClickEvent, which only includes the modifier keys that were pressed during both mouse down and mouse up. The code for handling link clicks has been moved into the click event handler, so that it's only triggered when the non-multi-cursor modifier was held for both the mouse down and mouse up events. Closes #12752, #16074, #17892 (the latter two seem to be duplicates of the former!) Release Notes: - Fixed a bug where pressing ctrl/cmd (or other modifiers) after mouse down but before mouse up still triggered ctrl/cmd+click behavior (e.g. "go to definition")
This commit is contained in:
parent
4892286465
commit
c28a4204ee
5 changed files with 96 additions and 19 deletions
|
@ -604,7 +604,7 @@ impl<D: PickerDelegate> Picker<D> {
|
|||
.id(("item", ix))
|
||||
.cursor_pointer()
|
||||
.on_click(cx.listener(move |this, event: &ClickEvent, window, cx| {
|
||||
this.handle_click(ix, event.down.modifiers.secondary(), window, cx)
|
||||
this.handle_click(ix, event.modifiers().secondary(), window, cx)
|
||||
}))
|
||||
// As of this writing, GPUI intercepts `ctrl-[mouse-event]`s on macOS
|
||||
// and produces right mouse button events. This matches platforms norms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue