Skip to content

Commit

Permalink
Fix LineDataEventAddon register call
Browse files Browse the repository at this point in the history
This would only cause problems if we disposed the addon before xterm was disposed
  • Loading branch information
Tyriar committed Oct 29, 2021
1 parent 1bb8780 commit b70ee4d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export class LineDataEventAddon extends Disposable implements ITerminalAddon {
activate(xterm: XTermTerminal) {
this._xterm = xterm;
// Fire onLineData when a line feed occurs, taking into account wrapped lines
xterm.onLineFeed(() => {
this._register(xterm.onLineFeed(() => {
const buffer = xterm.buffer;
const newLine = buffer.active.getLine(buffer.active.baseY + buffer.active.cursorY);
if (newLine && !newLine.isWrapped) {
this._sendLineData(buffer.active, buffer.active.baseY + buffer.active.cursorY - 1);
}
});
}));

// Fire onLineData when disposing object to flush last line
this._register(toDisposable(() => {
Expand Down

0 comments on commit b70ee4d

Please sign in to comment.