Move origin mode into core service

This commit is contained in:
Daniel Imms
2019-12-18 11:20:36 +11:00
parent bff74b1d7d
commit dada7fe728
5 changed files with 7 additions and 6 deletions
+4 -5
View File
@@ -626,7 +626,7 @@ export class InputHandler extends Disposable implements IInputHandler {
*/
private _restrictCursor(): void {
this._bufferService.buffer.x = Math.min(this._bufferService.cols - 1, Math.max(0, this._bufferService.buffer.x));
this._bufferService.buffer.y = this._terminal.originMode
this._bufferService.buffer.y = this._coreService.decPrivateModes.origin
? Math.min(this._bufferService.buffer.scrollBottom, Math.max(this._bufferService.buffer.scrollTop, this._bufferService.buffer.y))
: Math.min(this._bufferService.rows - 1, Math.max(0, this._bufferService.buffer.y));
this._dirtyRowService.markDirty(this._bufferService.buffer.y);
@@ -637,7 +637,7 @@ export class InputHandler extends Disposable implements IInputHandler {
*/
private _setCursor(x: number, y: number): void {
this._dirtyRowService.markDirty(this._bufferService.buffer.y);
if (this._terminal.originMode) {
if (this._coreService.decPrivateModes.origin) {
this._bufferService.buffer.x = x;
this._bufferService.buffer.y = this._bufferService.buffer.scrollTop + y;
} else {
@@ -1410,7 +1410,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._terminal.reset();
break;
case 6:
this._terminal.originMode = true;
this._coreService.decPrivateModes.origin = true;
this._setCursor(0, 0);
break;
case 7:
@@ -1593,7 +1593,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._terminal.reset();
break;
case 6:
this._terminal.originMode = false;
this._coreService.decPrivateModes.origin = false;
this._setCursor(0, 0);
break;
case 7:
@@ -1964,7 +1964,6 @@ export class InputHandler extends Disposable implements IInputHandler {
public softReset(params: IParams): void {
this._coreService.isCursorHidden = false;
this._terminal.insertMode = false;
this._terminal.originMode = false;
this._terminal.applicationKeypad = false; // ?
if (this._terminal.viewport) {
this._terminal.viewport.syncScrollArea();
-1
View File
@@ -26,7 +26,6 @@ export interface IInputHandlingTerminal {
cols: number;
rows: number;
applicationKeypad: boolean;
originMode: boolean;
insertMode: boolean;
bracketedPasteMode: boolean;
curAttrData: IAttributeData;
+1
View File
@@ -59,6 +59,7 @@ export class MockCoreService implements ICoreService {
isFocused: boolean = false;
decPrivateModes: IDecPrivateModes = {
applicationCursorKeys: false,
origin: false,
wraparound: true
};
onData: IEvent<string> = new EventEmitter<string>().event;
+1
View File
@@ -152,6 +152,7 @@ export interface IMarker extends IDisposable {
export interface IDecPrivateModes {
applicationCursorKeys: boolean;
origin: boolean;
wraparound: boolean; // defaults: xterm - true, vt100 - false
}
+1
View File
@@ -10,6 +10,7 @@ import { clone } from 'common/Clone';
const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
applicationCursorKeys: false,
origin: false,
wraparound: true // defaults: xterm - true, vt100 - false
});