fix(TabControl): broken selected_index diffing #46
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mupen64/ugui!46
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-tabcontrol-broken-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes broken diffing of
selected_indexwhen clicking the internal togglebuttons.Pull request overview
Fixes TabControl’s
selected_indexupdate logic when interacting with the per-tab internaltoggle_buttoncontrols so selection changes propagate correctly through the control’s diffing /signal_changemechanism.Changes:
meta.signal_change.selected_indexwhen the toggle button reports asignal_change_states.startedevent.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
meta.signal_change == ugui.signal_change_states.startedis not a reliable way to detect a fresh click here becauseprocess_signal_changesadvancesstarted -> ongoing(andended -> none) before considering the currentpressedflag. That means a quick re-click on the same tab (or switching back to a tab you clicked in the last couple frames, especially at low FPS) can yieldongoing/noneand this block won’t run, soselected_indexwon’t update. Prefer detecting the click directly (e.g., comparing the returned boolean toselected_index == iusing~=like the prior intent, or checkingugui.internal.clicked_control == control.uid + i) so every click is handled regardless of priorsignal_changestate.There are existing tabcontrol tests, but they currently only assert that rendering with no items doesn’t crash. Since this change alters click/selection behavior, please add a test that simulates clicking a tab and asserts the returned
selected_indexchanges andmeta.signal_changeis updated accordingly (and ideally covers rapid switching between tabs).