Skip to content

editor: Fix SelectionsCollection::disjoint not being ordered correctly - #40249

Merged
Veykril merged 1 commit into
mainfrom
push-wwqprpnyulnv
Oct 15, 2025
Merged

editor: Fix SelectionsCollection::disjoint not being ordered correctly#40249
Veykril merged 1 commit into
mainfrom
push-wwqprpnyulnv

Conversation

@Veykril

@Veykril Veykril commented Oct 15, 2025

Copy link
Copy Markdown
Member

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

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Oct 15, 2025
@Veykril
Veykril enabled auto-merge (squash) October 15, 2025 12:27
@Veykril Veykril self-assigned this Oct 15, 2025
@Veykril
Veykril merged commit 8ab52f3 into main Oct 15, 2025
22 checks passed
@Veykril
Veykril deleted the push-wwqprpnyulnv branch October 15, 2025 13:55
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
@github-actions github-actions Bot mentioned this pull request Feb 17, 2026
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
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.

1 participant