zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.9k stars 2.69k forks source link

Click and then Ctrl interpreted as Ctrl+click #16074

Open m93a opened 1 month ago

m93a commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

  1. Open a TypeScript file (or any language whose LSP supports jump to definition)
  2. Click on an identifier, and immediately after that press Ctrl
  3. See that Zed jumped to definition or opened References

Environment

Zed: v0.147.2 (Zed) OS: Linux X11 elementary 7.1 Memory: 15 GiB Architecture: x86_64 GPU: AMD Unknown (RADV RENOIR) || radv || Mesa 23.2.1-1ubuntu3.1~22.04.2

If applicable, add mockups / screenshots to help explain present your vision of the feature

https://github.com/user-attachments/assets/e0b16e42-1dfc-49c0-ad58-48656fc694eb

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-08-11T11:07:33.774950498+02:00 [INFO] new;
2024-08-11T11:07:33.775875188+02:00 [INFO] keep_updated;
2024-08-11T11:07:33.775985075+02:00 [INFO] new;
2024-08-11T11:07:34.164259661+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 261 }
2024-08-11T11:07:36.926346718+02:00 [INFO] Initializing default prettier with plugins {}
2024-08-11T11:07:36.926484448+02:00 [INFO] starting language servers for TypeScript: vtsls, eslint, deno
2024-08-11T11:07:37.006019708+02:00 [INFO] Language server with id 2 sent unhandled notification eslint/status:
{
  "uri": "file:///home/csha/Documents/chartium/lib/foo.ts",
  "state": 1,
  "validationTime": 20
}
2024-08-11T11:07:42.352069902+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 262 }
2024-08-11T11:08:06.748553013+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 263 }
2024-08-11T11:09:55.870712099+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 264 }
2024-08-11T11:09:56.191906523+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 265 }
2024-08-11T11:10:01.11631656+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 266 }
2024-08-11T11:10:52.310583136+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 267 }
2024-08-11T11:14:14.041743009+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.044815239+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.058347001+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.05908131+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.06544476+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.074362567+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.091901735+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.094000957+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.094314255+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.100455298+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.114430733+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.123201093+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.128049518+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.140109617+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.141930436+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.148953846+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.156592421+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.162861513+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.169887278+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.183788503+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.190685846+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.197784287+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.211888744+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.246735665+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:14.958449968+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:15.391649916+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 2, input_context_id: 268 }
2024-08-11T11:14:15.98004052+02:00 [INFO] Using surface present mode MAILBOX
2024-08-11T11:14:15.980331786+02:00 [WARN] Unable to forbid exclusive full screen
2024-08-11T11:14:16.011225342+02:00 [INFO] Using surface present mode MAILBOX
2024-08-11T11:14:16.012100585+02:00 [WARN] Unable to forbid exclusive full screen
2024-08-11T11:14:17.108816788+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:17.157952149+02:00 [INFO] Creating a descriptor pool for at most 4096 sets
2024-08-11T11:14:17.159163533+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:17.2072479+02:00 [INFO] Creating a descriptor pool for at most 4096 sets
2024-08-11T11:14:17.231865359+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:17.375779071+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:17.606374241+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:19.610398346+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:19.661623969+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:19.693689963+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:19.824431665+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:20.290579316+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:20.366803942+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-08-11T11:14:20.409064369+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
m93a commented 1 month ago

It is possible that my touchpad sends the mouseup event after a delay. However, in VSC I have no such problem.

It's extremely annoying when I want to click on an identifier and then Ctrl+Backpace to delete the beginning of it, but Zed yeets me into a different file and deletes the identifier's definition.

notpeter commented 1 month ago

I am not able to reproduce this on my Linux machine, I attempted with a trackpad and mouse but with no luck.

Could you see if this still happens with a different input device (mouse, etc) for you? Do you have any keyboard / mouse remapping or tools configured which might be contributing? (e.g. something that maps "ctrl-click" to right click, etc)

m93a commented 3 weeks ago

I tried to use a wireless mouse and can confirm that with a mouse this only occurs if the sequence of events is: mouse down, key down, mouse up. (This sequence of events does not trigger Go To Definition in VSC; only key down, mouse down, mouse up does.) Therefore the behavior reported in OP is only reproducible on the touchpad.

I'm using elementary OS 7.1 (based on Ubuntu 22.04.3) and, apart from elementary OS itself, I'm unaware of any 3rd party software that might be causing this.

Here's the output of xinput that might be relevant.

``` ➜ ~ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ DELL0A7A:00 04F3:3147 Mouse id=9 [slave pointer (2)] ⎜ ↳ DELL0A7A:00 04F3:3147 Touchpad id=10 [slave pointer (2)] ⎜ ↳ ETPS/2 Elantech Touchpad id=13 [slave pointer (2)] ... ➜ ~ xinput list-props 9 Device 'DELL0A7A:00 04F3:3147 Mouse': Device Enabled (170): 1 Coordinate Transformation Matrix (172): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Natural Scrolling Enabled (309): 0 libinput Natural Scrolling Enabled Default (310): 0 libinput Scroll Methods Available (311): 0, 0, 1 libinput Scroll Method Enabled (312): 0, 0, 1 libinput Scroll Method Enabled Default (313): 0, 0, 1 libinput Button Scrolling Button (314): 3 libinput Button Scrolling Button Default (315): 3 libinput Button Scrolling Button Lock Enabled (316): 0 libinput Button Scrolling Button Lock Enabled Default (317): 0 libinput Accel Speed (318): 0.000000 libinput Accel Speed Default (319): 0.000000 libinput Accel Profiles Available (320): 1, 1 libinput Accel Profile Enabled (321): 1, 0 libinput Accel Profile Enabled Default (322): 1, 0 libinput Left Handed Enabled (323): 0 libinput Left Handed Enabled Default (324): 0 libinput Send Events Modes Available (294): 1, 0 libinput Send Events Mode Enabled (295): 0, 0 libinput Send Events Mode Enabled Default (296): 0, 0 Device Node (297): "/dev/input/event5" Device Product ID (298): 1267, 12615 libinput Drag Lock Buttons (325): libinput Horizontal Scroll Enabled (326): 1 libinput Scrolling Pixel Distance (327): 15 libinput Scrolling Pixel Distance Default (328): 15 libinput High Resolution Wheel Scroll Enabled (329): 1 ➜ ~ xinput list-props 10 Device 'DELL0A7A:00 04F3:3147 Touchpad': Device Enabled (170): 1 Coordinate Transformation Matrix (172): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Tapping Enabled (330): 1 libinput Tapping Enabled Default (331): 0 libinput Tapping Drag Enabled (332): 1 libinput Tapping Drag Enabled Default (333): 1 libinput Tapping Drag Lock Enabled (334): 0 libinput Tapping Drag Lock Enabled Default (335): 0 libinput Tapping Button Mapping Enabled (336): 1, 0 libinput Tapping Button Mapping Default (337): 1, 0 libinput Natural Scrolling Enabled (309): 1 libinput Natural Scrolling Enabled Default (310): 0 libinput Disable While Typing Enabled (338): 1 libinput Disable While Typing Enabled Default (339): 1 libinput Scroll Methods Available (311): 1, 1, 0 libinput Scroll Method Enabled (312): 1, 0, 0 libinput Scroll Method Enabled Default (313): 1, 0, 0 libinput Click Methods Available (340): 1, 1 libinput Click Method Enabled (341): 0, 1 libinput Click Method Enabled Default (342): 1, 0 libinput Middle Emulation Enabled (343): 0 libinput Middle Emulation Enabled Default (344): 0 libinput Accel Speed (318): 0.000000 libinput Accel Speed Default (319): 0.000000 libinput Accel Profiles Available (320): 1, 1 libinput Accel Profile Enabled (321): 1, 0 libinput Accel Profile Enabled Default (322): 1, 0 libinput Left Handed Enabled (323): 0 libinput Left Handed Enabled Default (324): 0 libinput Send Events Modes Available (294): 1, 1 libinput Send Events Mode Enabled (295): 0, 0 libinput Send Events Mode Enabled Default (296): 0, 0 Device Node (297): "/dev/input/event9" Device Product ID (298): 1267, 12615 libinput Drag Lock Buttons (325): libinput Horizontal Scroll Enabled (326): 1 libinput Scrolling Pixel Distance (327): 15 libinput Scrolling Pixel Distance Default (328): 15 libinput High Resolution Wheel Scroll Enabled (329): 1 ➜ ~ xinput list-props 13 Device 'ETPS/2 Elantech Touchpad': Device Enabled (170): 1 Coordinate Transformation Matrix (172): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Tapping Enabled (330): 1 libinput Tapping Enabled Default (331): 0 libinput Tapping Drag Enabled (332): 1 libinput Tapping Drag Enabled Default (333): 1 libinput Tapping Drag Lock Enabled (334): 0 libinput Tapping Drag Lock Enabled Default (335): 0 libinput Tapping Button Mapping Enabled (336): 1, 0 libinput Tapping Button Mapping Default (337): 1, 0 libinput Natural Scrolling Enabled (309): 1 libinput Natural Scrolling Enabled Default (310): 0 libinput Disable While Typing Enabled (338): 1 libinput Disable While Typing Enabled Default (339): 1 libinput Scroll Methods Available (311): 1, 1, 0 libinput Scroll Method Enabled (312): 1, 0, 0 libinput Scroll Method Enabled Default (313): 1, 0, 0 libinput Click Methods Available (340): 1, 1 libinput Click Method Enabled (341): 0, 1 libinput Click Method Enabled Default (342): 1, 0 libinput Middle Emulation Enabled (343): 0 libinput Middle Emulation Enabled Default (344): 0 libinput Accel Speed (318): 0.000000 libinput Accel Speed Default (319): 0.000000 libinput Accel Profiles Available (320): 1, 1 libinput Accel Profile Enabled (321): 1, 0 libinput Accel Profile Enabled Default (322): 1, 0 libinput Left Handed Enabled (323): 0 libinput Left Handed Enabled Default (324): 0 libinput Send Events Modes Available (294): 1, 1 libinput Send Events Mode Enabled (295): 0, 0 libinput Send Events Mode Enabled Default (296): 0, 0 Device Node (297): "/dev/input/event7" Device Product ID (298): 2, 14 libinput Drag Lock Buttons (325): libinput Horizontal Scroll Enabled (326): 1 libinput Scrolling Pixel Distance (327): 15 libinput Scrolling Pixel Distance Default (328): 15 libinput High Resolution Wheel Scroll Enabled (329): 1 ```