Open SymphonyNineth opened 4 months ago
The issue title is easy to misinterpret—the specific issue is that pressing control after clicking still triggers go to definition/references.
I believe the root cause of this issue is that following links (go to def) runs on mouse up if control is held, even if control was not held at mouse down. As such, it is easy to accidentally trigger go to definition by pressing control immediately after clicking.
Specifically, this is in EditorElement::mouse_up
:
https://github.com/zed-industries/zed/blob/d5a6ca4914b5f009223df99a57cd799f2af4b470/crates/editor/src/element.rs#L578-L588
(Note that multi_cursor_modifier
is a misnomer -- it's actually whichever modifier isn't the multi-cursor modifier)
From experimenting a bit, it appears the VSCode handles this by only following the link if control was held at both mouse down and mouse up (though it doesn't check if it was held between those points).
It should be relatively straightforward to track whether the modifier key was held at the start of the mouse press and only trigger the action if the modifier was held at both the start and end of the press.
The issue title is easy to misinterpret—the specific issue is that pressing control after clicking still triggers go to definition/references.
I believe the root cause of this issue is that following links (go to def) runs on mouse up if control is held, even if control was not held at mouse down. As such, it is easy to accidentally trigger go to definition by pressing control immediately after clicking.
Specifically, this is in
EditorElement::mouse_up
:(Note that
multi_cursor_modifier
is a misnomer -- it's actually whichever modifier isn't the multi-cursor modifier)From experimenting a bit, it appears the VSCode handles this by only following the link if control was held at both mouse down and mouse up (though it doesn't check if it was held between those points).
It should be relatively straightforward to track whether the modifier key was held at the start of the mouse press and only trigger the action if the modifier was held at both the start and end of the press.
That could very well be the issue, however sadly i cannot patch it myself, i'm not very familiar with Rust(
Check for existing issues
Describe the bug / provide steps to reproduce it
Clicking on entity and afterwards pressing ctrl goes finds all the references(as if clicking while ctrl is pressed) instead of just not doing it :). I assume is not the expected behavior since it makes you wait for a while before you can use ctrl key after clicking somewhere and i constantly fall into the references tab.
Environment
Zed: v1.0.0 (Zed Dev 48581167b73165fe9f9c780a73a6be7c1602f7a9) OS: Linux 1.0.0 Memory: 31.1 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
For example here i click on SingleLine and then press ctrl to be able to delete the entire word right away with ctrl + backspace. I expect it to not go to the references because the ctrl key was not pressed at the time of clicking, but that's what the editor does.
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.No response