Skip to content

Commit 3ef664f

Browse files
committed
Delete lines from cache >=, not >
Fixes microsoft#234103
1 parent 0557387 commit 3ef664f

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/vs/editor/browser/gpu/fullFileRenderStrategy.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
129129
// TODO: This currently invalidates everything after the deleted line, it could shift the
130130
// line data up to retain some up to date lines
131131
// TODO: This does not invalidate lines that are no longer in the file
132-
for (const i of [0, 1]) {
133-
const upToDateLines = this._upToDateLines[i];
134-
const lines = Array.from(upToDateLines);
135-
for (const upToDateLine of lines) {
136-
if (upToDateLine > e.fromLineNumber) {
137-
upToDateLines.delete(upToDateLine);
138-
}
139-
}
140-
}
132+
this._invalidateLinesFrom(e.fromLineNumber);
141133

142134
// Queue updates that need to happen on the active buffer, not just the cache. This is
143135
// deferred since the active buffer could be locked by the GPU which would block the main
@@ -150,15 +142,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
150142
public override onLinesInserted(e: ViewLinesInsertedEvent): boolean {
151143
// TODO: This currently invalidates everything after the deleted line, it could shift the
152144
// line data up to retain some up to date lines
153-
for (const i of [0, 1]) {
154-
const upToDateLines = this._upToDateLines[i];
155-
const lines = Array.from(upToDateLines);
156-
for (const upToDateLine of lines) {
157-
if (upToDateLine > e.fromLineNumber) {
158-
upToDateLines.delete(upToDateLine);
159-
}
160-
}
161-
}
145+
this._invalidateLinesFrom(e.fromLineNumber);
162146
return true;
163147
}
164148

@@ -180,6 +164,18 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
180164

181165
// #endregion
182166

167+
private _invalidateLinesFrom(lineNumber: number): void {
168+
for (const i of [0, 1]) {
169+
const upToDateLines = this._upToDateLines[i];
170+
const lines = Array.from(upToDateLines);
171+
for (const upToDateLine of lines) {
172+
if (upToDateLine >= lineNumber) {
173+
upToDateLines.delete(upToDateLine);
174+
}
175+
}
176+
}
177+
}
178+
183179
reset() {
184180
for (const bufferIndex of [0, 1]) {
185181
// Zero out buffer and upload to GPU to prevent stale rows from rendering

0 commit comments

Comments
 (0)