Skip to content

fix(editor): preserve navigation jump history - #305

Merged
fcoury merged 3 commits into
mainfrom
fcoury/jumplist-navigation
Aug 22, 2026
Merged

fcoury merged 3 commits into
mainfrom
fcoury/jumplist-navigation

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Ctrl-O and Ctrl-I currently miss several editor-owned navigation paths. Queued input can also race Project Search selections and LSP definition responses, leaving the new destination absent from the jump list when traversal runs. Counted and stationary jumps, plus the previous-context mark, have additional Vim parity gaps.

What Changed

  • Record source locations for inline comment, Inline History, Agent change, file, location, and Git hunk navigation through the central jump-history path.
  • Defer jump traversal until in-flight definition and picker destinations have committed, preserving immediate Ctrl-O/Ctrl-I ordering.
  • Persist the per-window previous-context location and make repeated previous-context jumps toggle between the last two positions.
  • Treat counted G as an absolute line jump and preserve a return location for successful stationary jumps.
  • Add an optional jump flag to plugin SetCursorPosition requests and use it for bundled Git hunk navigation.
  • Add regression coverage for same-file, cross-file, session-restored, plugin-owned, and asynchronous navigation.

How to Test

  1. Place the cursor in one file, open Project Search, select a result in another file, and press Ctrl-O immediately after Enter. Expect the first Ctrl-O to return to the exact original file and position; Ctrl-I should reopen the result.

  2. Invoke gd on a symbol and press Ctrl-O before the definition response arrives. Expect Red to return after the destination commits, with Ctrl-I reopening the definition.

  3. Navigate with ]h or to the next inline comment, then press Ctrl-O. Expect a return to the source position.

  4. Run 3G, then Ctrl-O; repeat the previous-context command twice; and run G, move one line, then Ctrl-O. Expect absolute-line navigation, two-position toggling, and a usable stationary-jump return point.

  5. Run the focused regressions:

    cargo test --test movement
    cargo test inline_comment_navigation_participates_in_the_jumplist
    cargo test jump_back_waits_for_an_in_flight_definition_destination

The exact committed build also passed retained manual smoke coverage for Project Search, Git hunks, inline comments, real rust-analyzer definition navigation, and Vim parity cases.

@fcoury
fcoury merged commit d778dbe into main Aug 22, 2026
12 checks passed
@fcoury
fcoury deleted the fcoury/jumplist-navigation branch August 22, 2026 03:34
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.

2 participants