Break input handler dep on Terminal.scroll
This commit is contained in:
+5
-3
@@ -236,6 +236,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
public get onLineFeed(): IEvent<void> { return this._onLineFeed.event; }
|
public get onLineFeed(): IEvent<void> { return this._onLineFeed.event; }
|
||||||
private _onScroll = new EventEmitter<number>();
|
private _onScroll = new EventEmitter<number>();
|
||||||
public get onScroll(): IEvent<number> { return this._onScroll.event; }
|
public get onScroll(): IEvent<number> { return this._onScroll.event; }
|
||||||
|
private _onScrollRequest = new EventEmitter<IAttributeData, boolean | void>();
|
||||||
|
public get onScrollRequest(): IEvent<IAttributeData, boolean | void> { return this._onScrollRequest.event; }
|
||||||
private _onTitleChange = new EventEmitter<string>();
|
private _onTitleChange = new EventEmitter<string>();
|
||||||
public get onTitleChange(): IEvent<string> { return this._onTitleChange.event; }
|
public get onTitleChange(): IEvent<string> { return this._onTitleChange.event; }
|
||||||
private _onA11yChar = new EventEmitter<string>();
|
private _onA11yChar = new EventEmitter<string>();
|
||||||
@@ -554,7 +556,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
buffer.y++;
|
buffer.y++;
|
||||||
if (buffer.y === buffer.scrollBottom + 1) {
|
if (buffer.y === buffer.scrollBottom + 1) {
|
||||||
buffer.y--;
|
buffer.y--;
|
||||||
this._terminal.scroll(this._eraseAttrData(), true);
|
this._onScrollRequest.fire(this._eraseAttrData(), true);
|
||||||
} else {
|
} else {
|
||||||
if (buffer.y >= this._bufferService.rows) {
|
if (buffer.y >= this._bufferService.rows) {
|
||||||
buffer.y = this._bufferService.rows - 1;
|
buffer.y = this._bufferService.rows - 1;
|
||||||
@@ -693,7 +695,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
buffer.y++;
|
buffer.y++;
|
||||||
if (buffer.y === buffer.scrollBottom + 1) {
|
if (buffer.y === buffer.scrollBottom + 1) {
|
||||||
buffer.y--;
|
buffer.y--;
|
||||||
this._terminal.scroll(this._eraseAttrData());
|
this._onScrollRequest.fire(this._eraseAttrData());
|
||||||
} else if (buffer.y >= this._bufferService.rows) {
|
} else if (buffer.y >= this._bufferService.rows) {
|
||||||
buffer.y = this._bufferService.rows - 1;
|
buffer.y = this._bufferService.rows - 1;
|
||||||
}
|
}
|
||||||
@@ -2676,7 +2678,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._bufferService.buffer.y++;
|
this._bufferService.buffer.y++;
|
||||||
if (buffer.y === buffer.scrollBottom + 1) {
|
if (buffer.y === buffer.scrollBottom + 1) {
|
||||||
buffer.y--;
|
buffer.y--;
|
||||||
this._terminal.scroll(this._eraseAttrData());
|
this._onScrollRequest.fire(this._eraseAttrData());
|
||||||
} else if (buffer.y >= this._bufferService.rows) {
|
} else if (buffer.y >= this._bufferService.rows) {
|
||||||
buffer.y = this._bufferService.rows - 1;
|
buffer.y = this._bufferService.rows - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
|
|||||||
this._inputHandler.onRequestBell(() => this.bell());
|
this._inputHandler.onRequestBell(() => this.bell());
|
||||||
this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end));
|
this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end));
|
||||||
this._inputHandler.onRequestReset(() => this.reset());
|
this._inputHandler.onRequestReset(() => this.reset());
|
||||||
|
this._inputHandler.onScrollRequest((eraseAttr, isWrapped) => this.scroll(eraseAttr, isWrapped || undefined));
|
||||||
forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove);
|
forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove);
|
||||||
forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed);
|
forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed);
|
||||||
forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange);
|
forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { Terminal } from './Terminal';
|
|||||||
import { AttributeData } from 'common/buffer/AttributeData';
|
import { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import { IColorManager, IColorSet, ILinkMatcherOptions, ILinkifier, IViewport, ILinkifier2 } from 'browser/Types';
|
import { IColorManager, IColorSet, ILinkMatcherOptions, ILinkifier, IViewport, ILinkifier2 } from 'browser/Types';
|
||||||
import { IOptionsService, IUnicodeService } from 'common/services/Services';
|
import { IOptionsService, IUnicodeService } from 'common/services/Services';
|
||||||
import { EventEmitter } from 'common/EventEmitter';
|
|
||||||
import { IParams, IFunctionIdentifier } from 'common/parser/Types';
|
import { IParams, IFunctionIdentifier } from 'common/parser/Types';
|
||||||
import { ISelectionService } from 'browser/services/Services';
|
import { ISelectionService } from 'browser/services/Services';
|
||||||
|
|
||||||
@@ -198,23 +197,13 @@ export class MockTerminal implements ITerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MockInputHandlingTerminal implements IInputHandlingTerminal {
|
export class MockInputHandlingTerminal implements IInputHandlingTerminal {
|
||||||
public onA11yCharEmitter: EventEmitter<string>;
|
|
||||||
public onA11yTabEmitter: EventEmitter<number>;
|
|
||||||
public buffers: IBufferSet;
|
|
||||||
public buffer: IBuffer = new MockBuffer();
|
|
||||||
public viewport: IViewport;
|
public viewport: IViewport;
|
||||||
public scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void {
|
|
||||||
throw new Error('Method not implemented.');
|
|
||||||
}
|
|
||||||
public is(term: string): boolean {
|
public is(term: string): boolean {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public resize(x: number, y: number): void {
|
public resize(x: number, y: number): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public handler(data: string): void {
|
|
||||||
throw new Error('Method not implemented.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MockBuffer implements IBuffer {
|
export class MockBuffer implements IBuffer {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -23,7 +23,6 @@ export type LineData = CharData[];
|
|||||||
export interface IInputHandlingTerminal {
|
export interface IInputHandlingTerminal {
|
||||||
viewport: IViewport;
|
viewport: IViewport;
|
||||||
|
|
||||||
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
|
||||||
is(term: string): boolean;
|
is(term: string): boolean;
|
||||||
resize(x: number, y: number): void;
|
resize(x: number, y: number): void;
|
||||||
}
|
}
|
||||||
@@ -41,6 +40,7 @@ export interface ICompositionHelper {
|
|||||||
*/
|
*/
|
||||||
export interface IInputHandler {
|
export interface IInputHandler {
|
||||||
onTitleChange: IEvent<string>;
|
onTitleChange: IEvent<string>;
|
||||||
|
onScrollRequest: IEvent<IAttributeData, boolean | void>;
|
||||||
|
|
||||||
parse(data: string | Uint8Array): void;
|
parse(data: string | Uint8Array): void;
|
||||||
print(data: Uint32Array, start: number, end: number): void;
|
print(data: Uint32Array, start: number, end: number): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user