Repository navigation
fix(large-file): palette :N line jump offers scan instead of bogus jump (#2597) - #2623
Merged
Merged
Conversation
In a large file opened in byte-offset mode (no line index yet), the command-palette ":N" line-jump path resolved max_line from line_count().unwrap_or(1), clamping every target to line 1. The confirm teleported the cursor to the end of the file and reported "Jumped to line 1", and the live preview jumped the cursor to a wrong byte while typing. Route the palette ":N" path through the same "Scan file for exact line numbers?" flow as Ctrl+G / Go to Line when the active buffer has no line index, and suppress the live preview in that state. Extracts the shared `active_buffer_has_line_index` check used by both paths. Fixes #2597. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMKU14NH3YNSTQ1npdjTXe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2597.
In a large file opened in byte-offset mode (before a line-index scan has run), the command-palette
:Nline-jump path did not behave like theCtrl+G/ Go to Line flow:max_linewas resolved fromline_count().unwrap_or(1), clamping every target to line 1.goto_line_col(1, …)in byte-offset mode teleported the cursor to the end of the file while the status bar falsely reported "Jumped to line 1" — no scan offered.Ctrl+Galready handled this correctly by offering the "Scan file for exact line numbers?" prompt when no line index exists.Fix
active_buffer_has_line_index()check (previously inline in theAction::GotoLinehandler).execute_quick_open_result, when the palette:Npath runs against a buffer with no line index, open the sameGotoLineScanConfirmprompt asCtrl+Ginstead of clamping to line 1.confirm_prompt()takes the current prompt out first, so the newly-opened scan prompt survives.:Npreview when no line index exists, so the cursor stays put until the scan is offered.After answering
y, the file is scanned and the Go to Line prompt opens, exactly matching the existingCtrl+Gbehavior.Testing
test_palette_line_jump_offers_scan_in_large_fileinlarge_file_mode.rs: in byte-offset mode, palette:1000keeps the cursor at byte 0, offers the scan prompt on Enter (no "Jumped to line" message), and aftery+ scan lands on line 1000.large_file_modee2e suite passes (17 tests).Ctrl+P→:1000→ Scan file for exact line numbers? (y/N) →y→ scan builds the index → Go to line:1000→ lands on line 1000 with "Jumped to line 1000" (cursor never teleports to EOF).cargo fmt,cargo clippy -p fresh-editor --all-targets(clean; only pre-existing crate-wide lib warnings), build all green.🤖 Generated with Claude Code
https://claude.ai/code/session_01YMKU14NH3YNSTQ1npdjTXe
Generated by Claude Code