Skip to content

Commit

Permalink
code: Compare the string representation of URIs
Browse files Browse the repository at this point in the history
For some reason, the object representation of the same URI is not stable
leading to synchronised scrolling breaking after scrolling the preview
window.

Instead, compare the string representation of the uris which should
work around the differences that should not matter.
  • Loading branch information
alcarney committed Sep 29, 2024
1 parent 34d6d99 commit 4dab038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/changes/875.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure scrolling is still synchronised, even after scrolling the preview window
5 changes: 4 additions & 1 deletion code/src/node/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ export class PreviewManager {
}

private scrollView(editor: vscode.TextEditor) {
if (editor.document.uri !== this.currentUri) {
// For some reason, the object representation of the same URI is not stable
// leading this check to fail in cases where it should pass.
// Instead, compare the string representation of the uris.
if (editor.document.uri.toString() !== this.currentUri?.toString()) {
return
}

Expand Down

0 comments on commit 4dab038

Please sign in to comment.