Skip to content

feat(results): go back after an FK jump with ctrl+o - #366

Open
Vinsho wants to merge 2 commits into
Maxteabag:mainfrom
Vinsho:feat/fk-navigation-back
Open

Vinsho wants to merge 2 commits into
Maxteabag:mainfrom
Vinsho:feat/fk-navigation-back

Conversation

@Vinsho

@Vinsho Vinsho commented Dec 1, 2026 •

Copy link
Copy Markdown

Problem

o (follow FK) and O (show referencing rows) replace the editor query and the results grid. There is no way back to the row you jumped from, apart from digging through query history and finding the row again by hand.

Change

  • Each o / O jump pushes a back-stack entry: the editor query, the active result-table context (including its already-loaded FK metadata), the cursor cell and the target database. The stack holds at most 50 entries.
  • Ctrl+O (vim's jump-list "back") in the results pane pops the stack and re-runs that query. Once the table renders, the cursor goes back to the cell you jumped from. Repeated jumps unwind one step at a time.
  • The restored table context already has its FK metadata, so o / O work again right away.
  • Ctrl+O is only allowed while the stack is non-empty. In that case it shows as Back in the footer. o, O and Ctrl+O are now listed in the ? help.
  • A query error clears any pending cursor restore.
  • Focus now stays in the results pane on o / O / Ctrl+O. Before, loading the query into the editor moved focus to the query pane on every jump.

Tests

  • New tests/ui/keybindings/test_navigation_back.py: a real SQLite DB with an FK. Jump from posts.user_id, then Ctrl+O restores the original query, row count and cursor (1, 1). A second Ctrl+O is a no-op. The results table keeps focus throughout. Also checks that Ctrl+O is bound to navigate_back and only allowed when history exists.
  • Also run against a PostgreSQL DB by pressing the real o → Esc (on a failed jump) → Ctrl+O: the query and cursor were restored.
  • Full unit and UI suites pass (1805 passed, 3 skipped).

Complements #365.

🤖 Generated with Claude Code

Vinsho and others added 2 commits December 1, 2026 15:04
o / O replace the editor query and results, with no way back to where you
jumped from. Each jump now pushes the current query, its result-table
context (with FK metadata), cursor position and target database onto a
back-stack (max 50). `b` in the results pane pops it, re-runs that query
and restores the cursor once the table renders. Repeated jumps can be
unwound one at a time.

`b` is only active while the stack is non-empty and shows as "Back" in the
footer then; o / O / b are listed in help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use ctrl+o, vim's jump-list "go back", instead of b.

o / O / back loaded the query through the history loader, which focuses
the editor, so every jump left the results pane. Re-focus the results
table after loading when navigation started there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Vinsho Vinsho changed the title feat(results): go back after an FK jump with b feat(results): go back after an FK jump with ctrl+o Dec 1, 2026

This branch has not been deployed

No deployments
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.

1 participant