Merge pull request #131185 from microsoft/hediet/fixes-npe

Don't restore selection from markers when there are no markers
This commit is contained in:
Alexandru Dima 2021-08-23 10:57:13 +02:00 committed by GitHub
commit f3d4130f2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -331,6 +331,10 @@ export class CursorsController extends Disposable {
public onModelContentChanged(eventsCollector: ViewModelEventsCollector, e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent): void {
if (e instanceof ModelInjectedTextChangedEvent) {
// If injected texts change, the view positions of all cursors need to be updated.
if (this._isHandling) {
// The view positions will be updated when handling finishes
return;
}
const selectionsFromMarkers = this._cursors.readSelectionFromMarkers();
const newState = CursorState.fromModelSelections(selectionsFromMarkers);