Kaynağa Gözat

Change `update()` to only happen in terminal tag

The individual updates were initially so that each tag would be able to
standalone, but on reflection that turns out to be a non-consideration.
The single terminal update propogrates to all child tags, ensuring a
consistent display state at the end of command processing.
Weiyi Lou 10 yıl önce
ebeveyn
işleme
70daeed741
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5 5
      tags/terminal.tag

+ 5 - 5
tags/terminal.tag

@@ -68,7 +68,8 @@
    * - Make the input safe by transforming html entities.
    * - Keep the last command in history as we go to the next line.
    * - Based on shell response, perform special actions or append the output.
-   * - Update the prompt as required.
+   * - Set the prompt as required.
+   * - Make sure all tags update their display content.
    */
   process(prompt, input) {
     input = he.encode(input)
@@ -83,11 +84,11 @@
     }
     this.tags.commandline.setPrompt(this.shell.prompt)
     this.tags.commandline.command.value = ''
+    this.update()
   }
 
   clear() {
     this.tags.history.hist = []
-    this.update()
   }
 </terminal>
 
@@ -122,11 +123,11 @@
       if (typeof this.tags.lhs.write != 'undefined') {
         this.tags.lhs.write(value)
       }
-      this.update({ 'prompt': value })
+      this.prompt = value
     }
   }
 
-  process(e) {
+  process() {
     this.parent.process(this.prompt, this.command.value)
   }
 
@@ -143,7 +144,6 @@
     if (output) {
       output = this.preserveWhiteSpace(output)
       this.hist.push({ 'content': output })
-      this.update()
     }
   }