editor: Make cmd-alt-click behavior more consistent (#38733)
Tim Vermeulen
and
Joseph T. Lyons
created
Fixes two inconsistencies around the behavior of cmd-alt-click that mess
with my VSCode muscle memory:
- The definition is opened in a pane to the right of the current pane,
unless there exists an adjacent pane to the left and not to the right,
in which case it's opened in the pane on the left
- In case Go to Definition needs to open a multibuffer, cmd-alt-click
does not open it in an existing pane to the right of the current pane,
it always creates a new pane directly to the right of the current pane
This PR irons out this behavior by always going to the definition in the
pane directly to the right of the current one, creating one only if one
doesn't yet exist.
If changing `Workspace::adjacent_pane` to not consider an existing pane
to the left is undesirable then that logic could be moved somewhere
else, or we can make it user configurable if necessary. Also happy to
split this PR up if either of these changes is controversial 🙂
Before:
https://github.com/user-attachments/assets/395754cd-6ecb-40bf-ae61-ee8903eed4ae
After:
https://github.com/user-attachments/assets/002797b1-51a7-48e5-a8d0-100d3a5049eb
Release Notes:
- Made the behavior of cmd-alt-click more consistent
---------
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>