Skip to content

Commit c9ebf4d

Browse files
committed
Comment out jump to line delays for now
1 parent 57420e5 commit c9ebf4d

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

web/src/lib/components/diff/ConciseDiffView.svelte

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,17 @@
164164
{#if searchSegment.highlighted}<span
165165
{@attach (element) => {
166166
if (jumpToSearchResult && searchSegment.id === activeSearchResult) {
167+
element.scrollIntoView({ block: "center", inline: "center" });
167168
jumpToSearchResult = false;
168169
// See similar code & comment below around jumping to selections
169-
const scheduledJump = setTimeout(() => {
170-
element.scrollIntoView({ block: "center", inline: "center" });
171-
}, 200);
172-
return () => {
173-
clearTimeout(scheduledJump);
174-
};
170+
//const scheduledJump = setTimeout(() => {
171+
// jumpToSearchResult = false;
172+
// element.scrollIntoView({ block: "center", inline: "center" });
173+
//}, 200);
174+
//return () => {
175+
// jumpToSearchResult = false;
176+
// clearTimeout(scheduledJump);
177+
//};
175178
}
176179
}}
177180
class={{
@@ -215,18 +218,21 @@
215218
data-selection-end={boolAttr(view.isSelectionEnd(hunkIndex, lineIndex))}
216219
{@attach (element) => {
217220
if (jumpToSelection && selection && selection.hunk === hunkIndex && selectionMidpoint === lineIndex) {
221+
element.scrollIntoView({ block: "center", inline: "center" });
218222
jumpToSelection = false;
219223
// Need to schedule because otherwise the vlist rendering surrounding elements may shift things
220224
// and cause the element to scroll to the wrong position
221225
// This is not 100% reliable but is good enough for now
222-
const scheduledJump = setTimeout(() => {
223-
element.scrollIntoView({ block: "center", inline: "center" });
224-
}, 200);
225-
return () => {
226-
if (scheduledJump) {
227-
clearTimeout(scheduledJump);
228-
}
229-
};
226+
//const scheduledJump = setTimeout(() => {
227+
// jumpToSelection = false;
228+
// element.scrollIntoView({ block: "center", inline: "center" });
229+
//}, 200);
230+
//return () => {
231+
// if (scheduledJump) {
232+
// jumpToSelection = false;
233+
// clearTimeout(scheduledJump);
234+
// }
235+
//};
230236
}
231237
}}
232238
>

web/src/lib/diff-viewer.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export class MultiFileDiffViewerState {
562562
this.urlSelection = undefined;
563563
const file = this.fileDetails.find((f) => f.toFile === urlSelection.file);
564564
if (file && this.diffMetadata.linkable) {
565-
this.jumpToSelection = true;
565+
this.jumpToSelection = urlSelection.lines !== undefined;
566566
this.selection = {
567567
file,
568568
unresolvedLines: urlSelection.lines,

0 commit comments

Comments
 (0)