|
164 | 164 | {#if searchSegment.highlighted}<span |
165 | 165 | {@attach (element) => { |
166 | 166 | if (jumpToSearchResult && searchSegment.id === activeSearchResult) { |
| 167 | + element.scrollIntoView({ block: "center", inline: "center" }); |
167 | 168 | jumpToSearchResult = false; |
168 | 169 | // 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 | + //}; |
175 | 178 | } |
176 | 179 | }} |
177 | 180 | class={{ |
|
215 | 218 | data-selection-end={boolAttr(view.isSelectionEnd(hunkIndex, lineIndex))} |
216 | 219 | {@attach (element) => { |
217 | 220 | if (jumpToSelection && selection && selection.hunk === hunkIndex && selectionMidpoint === lineIndex) { |
| 221 | + element.scrollIntoView({ block: "center", inline: "center" }); |
218 | 222 | jumpToSelection = false; |
219 | 223 | // Need to schedule because otherwise the vlist rendering surrounding elements may shift things |
220 | 224 | // and cause the element to scroll to the wrong position |
221 | 225 | // 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 | + //}; |
230 | 236 | } |
231 | 237 | }} |
232 | 238 | > |
|
0 commit comments