fix flow control (#1093)

According to [xterm.js](http://xtermjs.org/docs/guides/flowcontrol/#ideas-for-a-better-mechanism), pause and resume are in wrong places.
This commit is contained in:
WeidiDeng
2023-04-27 10:30:36 +08:00
committed by GitHub
parent a767971836
commit 01f1ed55e3

View 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);