Skip to content

[Routine - VT] fix(commands): clamp bookmark position to document bounds in jumpToBookmark#80

Draft
winterdrive wants to merge 1 commit into
mainfrom
routine/vt-fix-jumptobookmark-clamp-260707
Draft

[Routine - VT] fix(commands): clamp bookmark position to document bounds in jumpToBookmark#80
winterdrive wants to merge 1 commit into
mainfrom
routine/vt-fix-jumptobookmark-clamp-260707

Conversation

@winterdrive

Copy link
Copy Markdown
Owner

Pre-flight Check

Open PRs / active branches checked before selecting this fix:

This PR only modifies src/commands.ts (the virtualTabs.jumpToBookmark command handler), which is not touched by any of the above. No functional or textual overlap.

Changes

virtualTabs.jumpToBookmark builds a vscode.Position directly from the stored bookmark.line / bookmark.character and immediately uses it for editor.selection and editor.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 Position with document.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:

  • Add/rename/remove any command registrations, configuration keys, or dependencies.
  • Modify package.json / package-lock.json / CHANGELOG.md.
  • Touch tab-group serialization or storage/config logic.

Safety Verification

Commands run locally, both passed:

  • npx tsc -p ./ — no errors
  • npm run test (tsc -p ./ && jest --runInBand) — 25 suites / 175 tests passed

No lint or format:check script exists in package.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.

…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.
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