Implement onRender in xterm-headless
This effectively enabled implementing an efficient renderer on top of xterm-headless. See #5392
This commit is contained in:
@@ -202,6 +202,15 @@ describe('Headless API Tests', function (): void {
|
||||
strictEqual(callCount, 2);
|
||||
});
|
||||
|
||||
it('onRender', async () => {
|
||||
const calls: { start: number, end: number }[] = [];
|
||||
term.onRender(e => calls.push(e));
|
||||
await writeSync('foo');
|
||||
deepStrictEqual(calls, [{ start: 0, end: 0 }]);
|
||||
await writeSync('\n\nbar');
|
||||
deepStrictEqual(calls, [{ start: 0, end: 0 }, { start: 0, end: 2 }]);
|
||||
});
|
||||
|
||||
it('onScroll', async () => {
|
||||
term = new Terminal({ rows: 5 });
|
||||
const calls: number[] = [];
|
||||
|
||||
@@ -77,6 +77,7 @@ export class Terminal extends Disposable implements ITerminalApi {
|
||||
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
||||
public get onData(): Event<string> { return this._core.onData; }
|
||||
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
||||
public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
|
||||
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
||||
public get onScroll(): Event<number> { return this._core.onScroll; }
|
||||
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
||||
|
||||
Reference in New Issue
Block a user