diff --git a/lib/program.js b/lib/program.js index 6c26821..afefb7d 100644 --- a/lib/program.js +++ b/lib/program.js @@ -1495,9 +1495,14 @@ Program.prototype._write = function(text) { // Example: `DCS tmux; ESC Pt ST` // Real: `DCS tmux; ESC Pt ESC \` Program.prototype._twrite = function(data) { - if (this.tmux) data = '\x1bPtmux;\x1b' + data + '\x1b\\'; - // Should work but tmux doesn't implement ST correctly: - // if (this.tmux) data = '\x1bPtmux;\x1b' + data + '\x07'; + if (this.tmux) { + data = '\x1bPtmux;\x1b' + data + '\x1b\\'; + // Should work but tmux doesn't implement ST correctly: + // data = '\x1bPtmux;\x1b' + data + '\x07'; + // NOTE: Flushing the buffer is required in some cases. + this.flush(); + return this.output.write(data); + } return this._write(data); };