Skip to content

Commit

Permalink
Fixes #208511 (#210917)
Browse files Browse the repository at this point in the history
  • Loading branch information
hediet authored Apr 22, 2024
1 parent a677b0e commit 0237a19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.render(true, forceRedraw);
this._modelData.viewModel.batchEvents(() => {
this._modelData!.view.render(true, forceRedraw);
});
}

public setAriaOptions(options: editorBrowser.IEditorAriaOptions): void {
Expand Down
2 changes: 2 additions & 0 deletions src/vs/editor/common/viewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export interface IViewModel extends ICursorSimpleModel {
//#region viewLayout
changeWhitespace(callback: (accessor: IWhitespaceChangeAccessor) => void): void;
//#endregion

batchEvents(callback: () => void): void;
}

export interface IViewLayout {
Expand Down
4 changes: 4 additions & 0 deletions src/vs/editor/common/viewModel/viewModelImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,10 @@ export class ViewModel extends Disposable implements IViewModel {
}
}

public batchEvents(callback: () => void): void {
this._withViewEventsCollector(() => { callback(); });
}

normalizePosition(position: Position, affinity: PositionAffinity): Position {
return this._lines.normalizePosition(position, affinity);
}
Expand Down

0 comments on commit 0237a19

Please sign in to comment.