Skip to content

[codex] Fix label selection across deferred viewports#8242

Draft
yay wants to merge 1 commit into
emilk:mainfrom
yay:codex/fix-deferred-viewport-label-selection
Draft

[codex] Fix label selection across deferred viewports#8242
yay wants to merge 1 commit into
emilk:mainfrom
yay:codex/fix-deferred-viewport-label-selection

Conversation

@yay

@yay yay commented Jun 18, 2026

Copy link
Copy Markdown

What changed

  • Keep label text-selection state separate for each viewport.
  • Route pass lifecycle and label painting through the current ViewportId.
  • Drop inactive per-viewport state after its pass.
  • Add a regression test that verifies an unrelated viewport pass cannot clear a child viewport's
    selection, while the owning viewport still clears selections whose labels disappear.

Why

Issue #4758 identified that deferred viewports need independent label-selection state. PR #4760
fixed it by keying the temporary state by viewport. The plugin refactor in PR #7385 moved that
state into one context-wide LabelSelectionState, which accidentally removed the viewport
isolation. A pass in another viewport then fails to encounter the selected widgets and clears the
selection.

This restores the behavior of #4760 within the current plugin architecture. Applications do not
need any special handling.

Validation

  • cargo test -p egui
  • cargo clippy -p egui --all-targets --all-features -- -D warnings
  • cargo test -p egui_tests test_atom_selectable_text_can_be_copied
  • Steady integration: cargo check -p steady --release
  • Steady integration: cargo test -p steady --release gui::note_window
  • ./scripts/check.sh passes formatting, lint, docs, debug/release/WASM clippy, all-target and
    all-feature tests, and doc tests. It then reaches an unrelated failure already present on
    upstream/main: maybe_attach_inspection_plugin is dead code in the no-default-feature
    egui_demo_app check.

@github-actions

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/8242-codex/fix-deferred-viewport-label-selection

View snapshot changes at kitdiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant