[Routine - VT] fix(commands): clamp bookmark position to document bounds in jumpToBookmark#80
Draft
winterdrive wants to merge 1 commit into
Draft
[Routine - VT] fix(commands): clamp bookmark position to document bounds in jumpToBookmark#80winterdrive wants to merge 1 commit into
winterdrive wants to merge 1 commit into
Conversation
…okmark Bookmarked line/character can exceed the current document if the file was edited (lines removed) since the bookmark was created, leaving the jump-to-bookmark selection/reveal to operate on an invalid position.
This was referenced Jul 7, 2026
Draft
Draft
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.
Pre-flight Check
Open PRs / active branches checked before selecting this fix:
routine/vt-fix-filemanager-relpath-260706— touchessrc/core/FileManager.ts,src/test/unit/fileManagerRelpath.test.tsroutine/vt-fix-bookmark-stale-groupidx-260703— touchessrc/provider.tsroutine/vt-fix-treeview-listener-disposal-260702— touchessrc/extension.tsrelease/0.7.6-260701— touchesCHANGELOG.md,package.json,package-lock.jsonThis PR only modifies
src/commands.ts(thevirtualTabs.jumpToBookmarkcommand handler), which is not touched by any of the above. No functional or textual overlap.Changes
virtualTabs.jumpToBookmarkbuilds avscode.Positiondirectly from the storedbookmark.line/bookmark.characterand immediately uses it foreditor.selectionandeditor.revealRange. If the target file was edited outside VirtualTabs (e.g. lines removed) since the bookmark was recorded, the stored line/character can exceed the current document's bounds, so the editor ends up selecting/revealing an invalid position.Fix: clamp the constructed
Positionwithdocument.validatePosition(...)(the standard VS Code API for this) before building the range/selection, so the jump always lands on the closest valid position in the current document instead.This PR does not:
package.json/package-lock.json/CHANGELOG.md.Safety Verification
Commands run locally, both passed:
npx tsc -p ./— no errorsnpm run test(tsc -p ./ && jest --runInBand) — 25 suites / 175 tests passedNo
lintorformat:checkscript exists inpackage.json, so those steps were skipped.CI / Release Gate Note
This is a daily routine Draft PR. Package version bump and CHANGELOG consolidation are intentionally deferred to the weekend release/integration PR. If CI fails solely due to the repository's version-bump/release-readiness gate, that is expected behavior for a routine PR, not a code validation failure.