Open a results tab per document that runs a query #5

Merged
claude-bot merged 1 commit from feat/per-document-results-tabs into main 2026-11-19 13:08:22 +00:00
Collaborator

Problem

All results shared one slot (last_outcome), so running a query from a different document replaced the previous document's results.

Changes

  • Buffer ids: every SqlBuffer gets a unique id. trigger_query tags each query with the active buffer's id (EngineCommand::ExecuteQuery { sql, source }), and the engine sends it back in EngineEvent::QueryFinished { source, outcome }. Results reach the right document even if you switch tabs or close the document while the query runs.
  • Results tabs: ResultsView holds a ResultTab per source document, shown as a tab strip above the grid. Re-running a query replaces that document's tab. Running from a different document opens a new tab. The finished query's tab comes to the front.
  • Per-tab grid state: filter, sort, selected cell, column widths and scroll position are kept per tab (GridState, parked while the tab is inactive).
  • Editor follow: switching editor tabs brings that document's results tab to the front. Tab titles follow buffer renames.
  • Closing: ×, middle-click, or :clear (active tab). Results tabs stay open when their document is closed.
  • Documented in AGENTS.md.

Testing

  • cargo test passes (21 tests), including 4 new ResultsView tests: new tab vs. replace, separate state per tab, which tab shows after closing one, title sync.
  • Not yet checked by hand in the Windows GUI.

🤖 Generated with Claude Code

## Problem All results shared one slot (`last_outcome`), so running a query from a different document replaced the previous document's results. ## Changes - **Buffer ids:** every `SqlBuffer` gets a unique `id`. `trigger_query` tags each query with the active buffer's id (`EngineCommand::ExecuteQuery { sql, source }`), and the engine sends it back in `EngineEvent::QueryFinished { source, outcome }`. Results reach the right document even if you switch tabs or close the document while the query runs. - **Results tabs:** `ResultsView` holds a `ResultTab` per source document, shown as a tab strip above the grid. Re-running a query replaces that document's tab. Running from a different document opens a new tab. The finished query's tab comes to the front. - **Per-tab grid state:** filter, sort, selected cell, column widths and scroll position are kept per tab (`GridState`, parked while the tab is inactive). - **Editor follow:** switching editor tabs brings that document's results tab to the front. Tab titles follow buffer renames. - **Closing:** `×`, middle-click, or `:clear` (active tab). Results tabs stay open when their document is closed. - Documented in `AGENTS.md`. ## Testing - `cargo test` passes (21 tests), including 4 new `ResultsView` tests: new tab vs. replace, separate state per tab, which tab shows after closing one, title sync. - Not yet checked by hand in the Windows GUI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Results used to live in a single shared slot, so running a query from
another document replaced the previous document's results. Each SQL
buffer now gets a unique id that is passed through the engine with its
query and echoed back in QueryFinished. ResultsView keeps one tab per
source document: re-running replaces that document's tab, running from
a different document opens a new one. Each tab keeps its own filter,
sort, selected cell, column widths and scroll position. Switching
editor tabs brings that document's results forward, and tab titles
follow buffer renames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-bot deleted branch feat/per-document-results-tabs 2026-11-19 13:08:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
daniel/qry-duck!5
No description provided.