Skip to content

feat(results): show two or more result sets as tabs above the grid - #3924

Merged
datlechin merged 2 commits into
mainfrom
feat/result-set-tabs
Oct 31, 2026
Merged

datlechin merged 2 commits into
mainfrom
feat/result-set-tabs

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Two to six results show as tabs in a bar above the grid, one click per switch. One result keeps the status-bar pull-down; more than six, or a pane too narrow for the names, keeps only the pull-down.
  • The tabs are an NSSegmentedControl, with the tabs role on macOS 27. Measured on 27.0.1: SwiftUI's segmented and .tabs pickers drop a segment's image, so the pin glyph on a pinned tab needs AppKit.
  • The result pull-down moves to the end of the tab row and keeps the list, Pin, Compare, Close and Close Others. No stock control reports which segment was right-clicked (setMenu(_:forSegment:) ignores right-click, there is no segment hit test), so there is no per-tab context menu.
  • Two results from one table read users and users (2). The pull-down title is a position, 2 of 4, and the comparison titles use the result names. ResultSetMenuModelTests.titleCountsResults changes from Result 2 of 4 to 2 of 4 on purpose.
  • Fixed in the code this touches:
    • Closing the active result selected the last result; it now selects the neighbour, as editor tabs do.
    • Close, Close Others and Clear Results dropped unsaved cell edits without asking. They now ask, each with its own wording.
    • Close Others ran one close per result in the view. It is now one coordinator operation that activates the kept result.
    • View > Close Result Tab blanked a table tab's rows, and Previous/Next/Close Result stayed enabled with nothing to do, in Agent mode too.
    • Dismissing an Error result's banner turned the result into "Query executed successfully". That banner now has no Dismiss: the message is the result.
    • A failed script copied its error onto the tab, so the banner sat over every result that succeeded. The error and its SQL now live on the Error result, and Fix with AI and /fix still find it.
    • Result names were cut inside an emoji (U+FFFD).
    • A new run numbered its results from 1 even with pinned results in front, repeating a pinned result's name.
  • The error banner's message gives way down to one line in a short pane, so the tab row and the status bar stay inside the 150pt minimum.

Test plan

  • New: ResultSetTabBarLayoutTests (tabs, fallback, more than six, pin and selection, width, 150pt pane), ScriptErrorResultTests (a failed script through the coordinator), close/close others/gate/menu-flag cases in ResultPinningTests, placement and error-precedence cases in QueryResultPresentationTests, ResultSetPolicyTests over 2 to 8 results, emoji truncation in ResultSetMenuModelTests and StatementAnchorTests.
  • QueryRunUITests clicks a result tab and checks the switch.

Fixes #3869

@datlechin
datlechin merged commit 3933e08 into main Oct 31, 2026
13 of 15 checks passed
@datlechin
datlechin deleted the feat/result-set-tabs branch October 31, 2026 04:26
@datlechin

Copy link
Copy Markdown
Member Author

Before and after, three results with the last one pinned.

Before After
Light Before, light After, light
Dark Before, dark After, dark

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.

Show multiple query result sets as tabs for one-click switching

1 participant

⌂ Proxy