Просмотр исходного кода

Merge pull request #1324 from ian-r-rose/clear_history_on_load

Prevent the loading-from-disk step from being in the editor history.
Steven Silvester 8 лет назад
Родитель
Сommit
0db0903912
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      src/editorwidget/widget.ts

+ 6 - 1
src/editorwidget/widget.ts

@@ -82,7 +82,12 @@ class EditorWidget extends CodeMirrorWidget {
     let editor = this.editor;
     let model = context.model;
     let doc = editor.getDoc();
-    doc.setValue(model.toString());
+    //Prevent the initial loading from disk from
+    //being in the editor history.
+    context.ready.then( () => {
+      doc.setValue(model.toString());
+      doc.clearHistory();
+    });
     this.title.label = context.path.split('/').pop();
     loadModeByFileName(editor, context.path);
     model.stateChanged.connect((m, args) => {