File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -122,15 +122,18 @@ export class DiffViewProvider {
122122 const endLine = accumulatedLines . length
123123 // Replace all content up to the current line with accumulated lines.
124124 const edit = new vscode . WorkspaceEdit ( )
125- const rangeToReplace = new vscode . Range ( 0 , 0 , endLine + 1 , 0 )
125+ const rangeToReplace = new vscode . Range ( 0 , 0 , endLine , 0 )
126126 const contentToReplace = accumulatedLines . slice ( 0 , endLine + 1 ) . join ( "\n" ) + "\n"
127127 edit . replace ( document . uri , rangeToReplace , this . stripAllBOMs ( contentToReplace ) )
128128 await vscode . workspace . applyEdit ( edit )
129129 // Update decorations.
130130 this . activeLineController . setActiveLine ( endLine )
131131 this . fadedOverlayController . updateOverlayAfterLine ( endLine , document . lineCount )
132132 // Scroll to the current line.
133- this . scrollEditorToLine ( endLine )
133+ const ranges = this . activeDiffEditor ?. visibleRanges
134+ if ( ranges && ranges . length > 0 && ranges [ 0 ] . start . line < endLine && ranges [ 0 ] . end . line > endLine ) {
135+ this . scrollEditorToLine ( endLine )
136+ }
134137
135138 // Update the streamedLines with the new accumulated content.
136139 this . streamedLines = accumulatedLines
You can’t perform that action at this time.
0 commit comments