editor: Fix SelectionsCollection::disjoint not being ordered correctly - #40249
Merged
Conversation
Veykril
enabled auto-merge (squash)
October 15, 2025 12:27
Veykril
force-pushed
the
push-wwqprpnyulnv
branch
from
October 15, 2025 13:36
be2b341 to
ef3a861
Compare
Veykril
added a commit
that referenced
this pull request
Oct 16, 2025
…tly (#40249) We've been seeing the occasional `cannot seek backwards` panic within `SelectionsCollection` without means to reproduce. I believe the cause is one of the callers of `MutableSelectionsCollection::select` not passing a well formed `Selection` where `start > end`, so this PR enforces the invariant in `select` by swapping the fields and setting `reversed` as required as the other mutator functions already do that as well. We could also just assert this instead, but it callers usually won't care about this so its the less user facing annoyance to just fix this invariant up internally. Fixes ZED-253 Fixes ZED-ZJ Fixes ZED-23S Fixes ZED-222 Fixes ZED-1ZV Fixes ZED-1SN Fixes ZED-1Z0 Fixes ZED-10E Fixes ZED-1X0 Fixes ZED-12M Fixes ZED-1GR Fixes ZED-1VE Fixes ZED-13X Fixes ZED-1G4 Release Notes: - Fixed occasional panics when querying selections
5 tasks
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
…tly (zed-industries#40249) We've been seeing the occasional `cannot seek backwards` panic within `SelectionsCollection` without means to reproduce. I believe the cause is one of the callers of `MutableSelectionsCollection::select` not passing a well formed `Selection` where `start > end`, so this PR enforces the invariant in `select` by swapping the fields and setting `reversed` as required as the other mutator functions already do that as well. We could also just assert this instead, but it callers usually won't care about this so its the less user facing annoyance to just fix this invariant up internally. Fixes ZED-253 Fixes ZED-ZJ Fixes ZED-23S Fixes ZED-222 Fixes ZED-1ZV Fixes ZED-1SN Fixes ZED-1Z0 Fixes ZED-10E Fixes ZED-1X0 Fixes ZED-12M Fixes ZED-1GR Fixes ZED-1VE Fixes ZED-13X Fixes ZED-1G4 Release Notes: - Fixed occasional panics when querying selections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've been seeing the occasional
cannot seek backwardspanic withinSelectionsCollectionwithout means to reproduce.I believe the cause is one of the callers of
MutableSelectionsCollection::selectnot passing a well formedSelectionwherestart > end, so this PR enforces the invariant inselectby swapping the fields and settingreversedas required as the other mutator functions already do that as well.We could also just assert this instead, but it callers usually won't care about this so its the less user facing annoyance to just fix this invariant up internally.
Fixes ZED-253
Fixes ZED-ZJ
Fixes ZED-23S
Fixes ZED-222
Fixes ZED-1ZV
Fixes ZED-1SN
Fixes ZED-1Z0
Fixes ZED-10E
Fixes ZED-1X0
Fixes ZED-12M
Fixes ZED-1GR
Fixes ZED-1VE
Fixes ZED-13X
Fixes ZED-1G4
Release Notes: