]> prime8.dev >> repos - ttyd.git/commitdiff
fix flow control (#1093)
authorWeidiDeng <weidi_deng@icloud.com>
Thu, 27 Apr 2023 02:30:36 +0000 (10:30 +0800)
committerGitHub <noreply@github.com>
Thu, 27 Apr 2023 02:30:36 +0000 (10:30 +0800)
According to [xterm.js](http://xtermjs.org/docs/guides/flowcontrol/#ideas-for-a-better-mechanism), pause and resume are in wrong places.

html/src/components/terminal/xterm/index.ts

index e6809e42d7cdb8db4b82d1323720d4cdc00d67c3..ac49b9ffae545c197179b6b01c44916ccce80dfc 100644 (file)
@@ -199,13 +199,13 @@ export class Xterm {
             terminal.write(data, () => {
                 this.pending = Math.max(this.pending - 1, 0);
                 if (this.pending < lowWater) {
-                    this.socket?.send(textEncoder.encode(Command.PAUSE));
+                    this.socket?.send(textEncoder.encode(Command.RESUME));
                 }
             });
             this.pending++;
             this.written = 0;
             if (this.pending > highWater) {
-                this.socket?.send(textEncoder.encode(Command.RESUME));
+                this.socket?.send(textEncoder.encode(Command.PAUSE));
             }
         } else {
             terminal.write(data);