Commit 0e8c394
fix(linux): unified-tabs audit cleanup (B1-B5+B8)
Five fixes from the post-a8f573fc audit. All observable in normal use.
B1 — Window title now updates on tab switch.
WorkspaceTabsChanged previously only persisted state. The title
shows "<table> · <connection> · <driver>" when a Browse tab is
active, so the previous tab's table name lingered after switching.
Fix: introduce on_workspace_tabs_changed that does
persist_workspace_state + refresh_window_title + sync_sidebar_selection
in one shot. Single dispatcher handler so the trio stays in lockstep.
B2 — Drag-reorder now persists.
Only connect_selected_page_notify was wired, so dragging tabs into
a new order didn't write workspace_state.json until the next other
event (e.g. selecting a tab). Restart-then the order was wrong.
Fix: also wire connect_pages_notify → AppMsg::WorkspaceTabsChanged.
Insert/remove/reorder all flow through the same persist path.
B3 — Overview "+" tab labelling.
The AdwTabOverview "+" button entry-point synthesised an editor
slot inline with the hardcoded label "Empty query"; append_editor_tab
labels new tabs "Query 1", "Query 2", … via default_editor_tab_label.
Same widget kind, two different labels depending on entry point.
Fix: count existing editor tabs in the overview closure and use
default_editor_tab_label(count + 1). Both paths now produce the
same label.
B4 — Sidebar selection now follows the active Browse tab.
Switching from `users` tab to `orders` tab left the sidebar's
highlighted row on whichever was last *clicked*, regardless of
the active tab. Visually misleading.
Fix: sync_sidebar_selection (called from on_workspace_tabs_changed)
walks the listbox children, finds the row whose title + paired
schema matches the active Browse tab, and calls listbox.select_row.
No-op when active is an Editor tab (sidebar selection persists,
matching user intuition: you switch to editor and back, sidebar
state shouldn't reshuffle). select_row doesn't fire row-activated
(user gesture only) so this can't recurse into SelectTable.
B5 — "Replace current tab" from history with a Browse tab active.
HistoryDialogOutput::ReplaceCurrentTabQuery → AppMsg::ReplaceActiveTabQuery
→ on_replace_active_tab_query previously checked if the active tab
was an Editor; if not, silent no-op. User clicked "Replace" while
browsing → nothing happened, no feedback.
Fix: when active is Browse (or no tab), fall back to opening a
new Editor tab with the query. Mirrors "Open in new tab" semantics
but keeps the user's intent of running this query right now.
B8 — History "Open/Replace" while disconnected.
History is app-wide (Ctrl+H works disconnected to view past queries
across sessions). But OpenHistoryQuery / ReplaceActiveTabQuery without
an active connection silently created an invisible tab in the
workspace_root that was never displayed.
Fix: gate both OpenHistoryQuery and ReplaceActiveTabQuery on
self.connected; show a "Connect to a database first" toast when
the user clicks while disconnected.
Deferred from the audit:
B6 (F5 / Ctrl+F context-sensitivity) — design choice, separate fix
B7 (read-only fan-out) — no path triggers a live read-only flip today
B9 (double persist on selection change) — minor I/O wastage
B10 (monotonic editor labels) — cosmetic; user retypes anyway
Verification:
- cargo clippy --workspace --all-targets -- -D warnings: zero warnings
- cargo test --workspace --lib: 43 pass, 1 ignored
- cargo fmt --all -- --check: clean
- cargo build -p tablepro-app: clean
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a8f573f commit 0e8c394
2 files changed
Lines changed: 80 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
| 693 | + | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
760 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
761 | 772 | | |
762 | | - | |
763 | 773 | | |
764 | 774 | | |
765 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
| |||
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
| |||
104 | 116 | | |
105 | 117 | | |
106 | 118 | | |
107 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
108 | 125 | | |
109 | 126 | | |
110 | 127 | | |
| |||
495 | 512 | | |
496 | 513 | | |
497 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
498 | 553 | | |
499 | 554 | | |
500 | 555 | | |
| |||
594 | 649 | | |
595 | 650 | | |
596 | 651 | | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
602 | 661 | | |
| 662 | + | |
603 | 663 | | |
| 664 | + | |
604 | 665 | | |
605 | 666 | | |
606 | 667 | | |
| |||
0 commit comments