浏览代码

Bugfix: console history submission without an edit to text entiered by history was broken.

A. Darian 9 年之前
父节点
当前提交
b49f3cdd73
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/console/widget.ts

+ 5 - 5
src/console/widget.ts

@@ -539,21 +539,21 @@ class ConsoleWidget extends Widget {
    * Handle an edge requested signal.
    * Handle an edge requested signal.
    */
    */
   protected onEdgeRequest(editor: CellEditorWidget, location: EdgeLocation): void {
   protected onEdgeRequest(editor: CellEditorWidget, location: EdgeLocation): void {
-    let doc = editor.editor.getDoc();
+    let prompt = this.prompt;
     if (location === 'top') {
     if (location === 'top') {
       this._history.back().then(value => {
       this._history.back().then(value => {
         if (!value) {
         if (!value) {
           return;
           return;
         }
         }
-        doc.setValue(value);
-        doc.setCursor(doc.posFromIndex(0));
+        prompt.model.source = value;
+        prompt.editor.setCursorPosition(0);
       });
       });
     } else {
     } else {
       this._history.forward().then(value => {
       this._history.forward().then(value => {
         // If at the bottom end of history, then clear the prompt.
         // If at the bottom end of history, then clear the prompt.
         let text = value || '';
         let text = value || '';
-        doc.setValue(text);
-        doc.setCursor(doc.posFromIndex(text.length));
+        prompt.model.source = text;
+        prompt.editor.setCursorPosition(text.length);
       });
       });
     }
     }
   }
   }