Skip to content

Fix multicursors not being added when clicking on line numbers #28263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2025

Conversation

neunato
Copy link
Contributor

@neunato neunato commented Apr 7, 2025

Closes #21372

Release Notes:

  • Fixed multicursors not being added when clicking on line numbers

I tracked this down to

click_count = 3; // Simulate triple-click when clicking the gutter to select lines

being forwarded to editor.select() a few lines below

editor.select(
SelectPhase::Begin {
position,
add: multi_cursor_modifier,
click_count,
},
window,
cx,
);

resulting in add == true and click_count == 3, triggering this

} else if click_count > 1 {
s.delete(newest_selection.id)
}

... and we end up removing the previous selection.

This was added in 2021 under this reasoning:

This prevents selections added in earlier clicks from being rendered under the pending selection.

which no longer seems to be an issue, so removing should be safe?

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 7, 2025
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch and investigation, thank you a lot for explaining.

@SomeoneToIgnore SomeoneToIgnore self-assigned this May 6, 2025
@SomeoneToIgnore SomeoneToIgnore merged commit 52ea501 into zed-industries:main May 6, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alt-clicking on line numbers does not add cursors
3 participants