Fixes #5362: MainThreadTextEditor: disassociate code editor as soon as code editor's model changes

This commit is contained in:
Alex Dima
2016-04-28 17:14:58 +02:00
parent 10ef60a0b7
commit b02c4facaf
5 changed files with 113 additions and 3 deletions

View File

@@ -126,6 +126,11 @@ export class MainThreadTextEditor {
this._codeEditor = codeEditor;
if (this._codeEditor) {
// Catch early the case that this code editor gets a different model set and disassociate from this model
this._codeEditorListeners.push(this._codeEditor.addListener2(EditorCommon.EventType.ModelChanged, () => {
this.setCodeEditor(null);
}));
let forwardSelection = () => {
this._lastSelection = this._codeEditor.getSelections();
this._onSelectionChanged.fire(this._lastSelection);