Force a sync render after resize occurs

Fixes #4922
Related microsoft/vscode#230120
This commit is contained in:
Daniel Imms
2025-12-28 14:38:42 -08:00
parent b989c5a568
commit 4619a755b1
3 changed files with 18 additions and 4 deletions
+5
View File
@@ -39,6 +39,11 @@ export interface IRenderDimensions {
export interface IRequestRedrawEvent {
start: number;
end: number;
/**
* Whether the redraw should happen synchronously. This is used to avoid
* flicker when the canvas is resized.
*/
sync?: boolean;
}
/**
+8 -3
View File
@@ -144,7 +144,7 @@ export class RenderService extends Disposable implements IRenderService {
}
}
public refreshRows(start: number, end: number, isRedrawOnly: boolean = false): void {
public refreshRows(start: number, end: number, isRedrawOnly: boolean = false, sync: boolean = false): void {
if (this._isPaused) {
this._needsFullRefresh = true;
return;
@@ -164,7 +164,12 @@ export class RenderService extends Disposable implements IRenderService {
if (!isRedrawOnly) {
this._isNextRenderRedrawOnly = false;
}
this._renderDebouncer.refresh(start, end, this._rowCount);
if (sync) {
this._renderRows(start, end);
} else {
this._renderDebouncer.refresh(start, end, this._rowCount);
}
}
private _renderRows(start: number, end: number): void {
@@ -234,7 +239,7 @@ export class RenderService extends Disposable implements IRenderService {
this._renderer.value = renderer;
// If the value was not set, the terminal is being disposed so ignore it
if (this._renderer.value) {
this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));
this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true, e.sync));
// Force a refresh
this._needsSelectionRefresh = true;