Repository navigation
Ribbon: each window keeps its own tab, so Table Design stays active (#2903) - #3041
Conversation
620c520 to
85bfe35
Compare
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Store and verify per-window ribbon tabs crates/ui-egui/src/window_ui.rs, crates/ui-egui/tests/it/contextual_ribbon_tab.rs |
WindowUi initializes and swaps each window’s ribbon tab. The integration test checks the tab and selection across two windows. |
Contributor entry
| Layer / File(s) | Summary |
|---|---|
Add contributor entry contributors/people.toml |
The contributor data adds an entry with GitHub-name synchronization enabled. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: aiongg, dylanmtaylor
Merge Risk: 
Minimal · up to aacde
-
No actionable merge-blocking risk is established; the changes are safe to merge.
Architecture risk: 
Low · up to aacde
-
The change affects 2 systems.
Changed systems:
crates,contributorsArchitecture concerns
No architecture-level concerns identified.Review details
-
Systems and components
- observed — crates (service) was modified; 2 changed files map to changed impact.
- observed — contributors (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in crates/ui-egui/src/window_ui.rs:
WindowUiadds a per-windowribbon_tabfield.WindowUi::freshnow accepts the current ribbon tab and initializes the new state with a copy of it. - observed — Modified behavior in crates/ui-egui/src/window_ui.rs:
swap_window_uinow destructures the per-window ribbon tab fromWindowUi. - observed — Modified behavior in crates/ui-egui/src/window_ui.rs:
swap_window_uinow exchangesself.ui.ribbon_tabwith the tab stored in the window state. - observed — Modified behavior in crates/ui-egui/src/window_ui.rs: When creating the outgoing window state,
follow_active_windownow passes the current ribbon tab toWindowUi::fresh.
-
Pre-merge checks: 
3 · 
1 · 
1
-
Failed checks: 1 warning · 1 inconclusive Passed checks: 3 passed-
Full details: Linked Issues check
-
Explanation
Issue
#2903requires that the Table Design contextual tab stays selected while a cell inside the table is active. The tab must not flash and return to Home. The root cause is the app-wide ui.ribbon_tab, which another window's frame reset. The whole-PR diff (merge base 67e39fa to head aacdec4) confirms the source fix in crates/ui-egui/src/window_ui.rs. WindowUi now stores ribbon_tab. swap_window_ui swaps it with self.ui.ribbon_tab, so each window's contextual tab is judged against its own selection. WindowUi::fresh copies the current tab into a new window, so File › New/Open keeps the ribbon as it was. The regression test contextual_ribbon_tab::a_second_window_does_not_reset_the_first_windows_table_design_tab covers the reported two-window case. This pass did not re-read the test diff or run the test suite. The PR reports that the test fails on main and passes with the change. That report is not verified here.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Full details: Out of Scope Changes check
-
Explanation
The window_ui.rs and contextual_ribbon_tab.rs changes connect directly to
#2903. The raw summary also lists contributors/people.toml (+3/-0), which adds a [people.maxm11] entry. This entry does not relate to the ribbon defect in#2903. The file header allows a contributor to add only their own entry, in their own PR. The base blob and the diff for contributors/people.toml could not be read because the changed blobs are missing from the checkout. The head file shows the maxm11 entry at its end, but the change against base is not confirmed. The PR description does not name the PR author, so it is not established that maxm11 is the author.Resolution
Confirm that the contributors/people.toml change is present in this PR and is the entry for the PR author. Make the base and head blobs of contributors/people.toml readable so that the diff can be checked. If the change is confirmed and the entry belongs to the author, keep it as an administrative change or move it to a separate PR. If it belongs to another person, remove it from this PR.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the hunks: each window keeps its own ribbon tab (ribbon_tab on WindowUi), because a contextual tab like Table Design depends on that window's selection and another window's frame reset it (#2903). The reasoning is right. The PR also adds maxm11 to contributors/people.toml; #3038 adds the same lines at the same spot, so whichever merges second will conflict. Please rebase one on the other or drop the duplicate. I did not read the rest of window_ui.rs; add a two-window test.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
|
Merged in ea1d52f. Thanks, per-window ribbon tabs fix the Table Design flicker nicely. |
Closes #2903.
Root cause
app.ui.ribbon_tabwas global to the app, whileribbon::showresets an unavailable contextual tab to Home for the window it is drawing. With two windows (e.g. one on each screen),DocWindows::showdraws every window each frame. A window whose active cell is outside the table reset the shared tab to Home after the other window had selected Table Design, so the tab flashed and fell back to Home even though the first window's selection was still in the table. Restarting removed the second window, which is why the reporter saw it work after a restart.Change
WindowUinow carries the window'sribbon_tab, swapped with the rest of the per-window interface state. A new window inherits the current tab (preserving File › New/Open keeping the ribbon as it was); after that, each window's contextual tab is judged against its own selection.Test
contextual_ribbon_tab::a_second_window_does_not_reset_the_first_windows_table_design_tabcreates a second window on the same workbook with its active cell outside the table, clicks Table Design in the first window, draws the second window's frame, and asserts the first window's tab and table selection survive while the second window shows Home. It fails on main (left: "Home", right: "Table Design").Validation
cargo test -p gridcraft-ui-egui --test it: 903 passed, 2 failed; both failures are pre-existing on main without the optionalCRAFT_FONTS_DIRinput (interaction::column_autocomplete_folds_case_beyond_ascii: no glyph for ẞ;interaction::language_switch_renders_the_ribbon_and_persists: no glyph for ẻ). Confirmed the autocomplete failure on unmodified main.cargo test --workspace --lib --bins --testswith those two font-dependent tests skipped: passes (24 test binaries).cargo xtask ci: i18n-report, fmt, clippy pass; test stops at the same two environmental font failures.assets,layers,parity --check,keytips --check,cargo test --workspace --docpass separately.cargo xtask wasmcould not run here: this machine's Rust is a Homebrew install with norustupand nowasm32-unknown-unknowntarget. The change is ordinaryStringstate inui-egui.TextInput(unrelated to this change).Summary by CodeRabbit