Skip to content

terminal: Preserve terminal order and fix pinned count on workspace restore#44464

Merged
SomeoneToIgnore merged 4 commits intozed-industries:mainfrom
vampik33:terminal-position
Feb 12, 2026
Merged

terminal: Preserve terminal order and fix pinned count on workspace restore#44464
SomeoneToIgnore merged 4 commits intozed-industries:mainfrom
vampik33:terminal-position

Conversation

@vampik33
Copy link
Contributor

@vampik33 vampik33 commented Dec 9, 2025

Replace FuturesUnordered with FuturesOrdered to maintain terminal tab ordering when restoring a workspace.
Also clamp pinned_count to items_len() to prevent panics when fewer terminals are restored than expected.

The changes:

  1. Order preservation: FuturesUnorderedFuturesOrdered ensures terminals restore in their original order
  2. Bounds fix: .min(pane.items_len()) prevents setting pinned count higher than actual items

Closes #44463

Release Notes:

  • Preserved terminal order and fixed pinned count on workspace restore

Replace FuturesUnordered with join_all to maintain terminal tab ordering when restoring a workspace. Also clamp pinned_count to items_len() to prevent panics when fewer terminals are restored than expected.

The changes:
1. Order preservation: FuturesUnordered → join_all ensures terminals restore in their original order
2. Bounds fix: .min(pane.items_len()) prevents setting pinned count higher than actual items
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 9, 2025
@osiewicz
Copy link
Member

osiewicz commented Dec 9, 2025

Nit: could we use FuturesOrdered instead? https://docs.rs/futures/latest/futures/future/fn.join_all.html#see-also

Replace join_all with FuturesOrdered which only polls futures that have been woken, resulting in more efficient polling when deserializing multiple terminal views.
@vampik33
Copy link
Contributor Author

vampik33 commented Dec 9, 2025

Nit: could we use FuturesOrdered instead? https://docs.rs/futures/latest/futures/future/fn.join_all.html#see-also

Thank you for your suggestion. Change this to the FuturesOrdered as you proposed.

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.

Thank you.

@SomeoneToIgnore SomeoneToIgnore changed the title terminal: Preserve terminal order and fix pinned count on restore terminal: Preserve terminal order and fix pinned count on workspace restore Feb 12, 2026
@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) February 12, 2026 09:55
@SomeoneToIgnore SomeoneToIgnore merged commit e8cfd19 into zed-industries:main Feb 12, 2026
30 checks passed
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Feb 12, 2026
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

Development

Successfully merging this pull request may close these issues.

Terminal order is not preserved after restart of IDE

4 participants