Skip to content

Commit

Permalink
fix flow control (#1093)
Browse files Browse the repository at this point in the history
According to [xterm.js](http://xtermjs.org/docs/guides/flowcontrol/#ideas-for-a-better-mechanism), pause and resume are in wrong places.
  • Loading branch information
WeidiDeng committed Apr 27, 2023
1 parent a767971 commit 01f1ed5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions html/src/components/terminal/xterm/index.ts
Expand Up @@ -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);
Expand Down

0 comments on commit 01f1ed5

Please sign in to comment.