diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 98b85ba3..42c84769 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -405,6 +405,34 @@ export class InputHandler implements IInputHandler { } } + /** + * CSI Ps S Scroll up Ps lines (default = 1) (SU). + */ + public scrollUp(params: number[]): void { + let param = params[0] || 1; + while (param--) { + this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 1); + this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 0, this._terminal.blankLine()); + } + // this.maxRange(); + this._terminal.updateRange(this._terminal.scrollTop); + this._terminal.updateRange(this._terminal.scrollBottom); + } + + /** + * CSI Ps T Scroll down Ps lines (default = 1) (SD). + */ + public scrollDown(params: number[]): void { + let param = params[0] || 1; + while (param--) { + this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 1); + this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 0, this._terminal.blankLine()); + } + // this.maxRange(); + this._terminal.updateRange(this._terminal.scrollTop); + this._terminal.updateRange(this._terminal.scrollBottom); + } + /** * CSI Ps X * Erase Ps Character(s) (default = 1) (ECH). @@ -426,6 +454,16 @@ export class InputHandler implements IInputHandler { } } + /** + * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). + */ + public cursorBackwardTab(params: number[]): void { + let param = params[0] || 1; + while (param--) { + this._terminal.x = this._terminal.prevStop(); + } + } + /** * CSI Pm ` Character Position Absolute * [column] (default = [row,1]) (HPA). @@ -457,6 +495,19 @@ export class InputHandler implements IInputHandler { } } + /** + * CSI Ps b Repeat the preceding graphic character Ps times (REP). + */ + public repeatPrecedingCharacter(params: number[]): void { + let param = params[0] || 1 + , line = this._terminal.lines.get(this._terminal.ybase + this._terminal.y) + , ch = line[this._terminal.x - 1] || [this._terminal.defAttr, ' ', 1]; + + while (param--) { + line[this._terminal.x++] = ch; + } + } + /** * CSI Ps c Send Device Attributes (Primary DA). * Ps = 0 or omitted -> request attributes from terminal. The @@ -574,6 +625,22 @@ export class InputHandler implements IInputHandler { } } + /** + * CSI Ps g Tab Clear (TBC). + * Ps = 0 -> Clear Current Column (default). + * Ps = 3 -> Clear All. + * Potentially: + * Ps = 2 -> Clear Stops on Line. + * http://vt100.net/annarbor/aaa-ug/section6.html + */ + public tabClear(params: number[]): void { + let param = params[0]; + if (param <= 0) { + delete this._terminal.tabs[this._terminal.x]; + } else if (param === 3) { + this._terminal.tabs = {}; + } + } /** * CSI Pm h Set Mode (SM). @@ -1214,6 +1281,27 @@ export class InputHandler implements IInputHandler { } } + /** + * CSI ! p Soft terminal reset (DECSTR). + * http://vt100.net/docs/vt220-rm/table4-10.html + */ + public softReset(params: number[]): void { + this._terminal.cursorHidden = false; + this._terminal.insertMode = false; + this._terminal.originMode = false; + this._terminal.wraparoundMode = false; // autowrap + this._terminal.applicationKeypad = false; // ? + this._terminal.viewport.syncScrollArea(); + this._terminal.applicationCursor = false; + this._terminal.scrollTop = 0; + this._terminal.scrollBottom = this._terminal.rows - 1; + this._terminal.curAttr = this._terminal.defAttr; + this._terminal.x = this._terminal.y = 0; // ? + this._terminal.charset = null; + this._terminal.glevel = 0; // ?? + this._terminal.charsets = [null]; // ?? + } + /** * CSI Ps ; Ps r * Set Scrolling Region [top;bottom] (default = full size of win- diff --git a/src/Interfaces.ts b/src/Interfaces.ts index b0f4464f..0079b856 100644 --- a/src/Interfaces.ts +++ b/src/Interfaces.ts @@ -45,33 +45,39 @@ export interface IInputHandler { /** C0 SO */ shiftOut(): void; /** C0 SI */ shiftIn(): void; - /** CSI @ */ insertChars(params); - /** CSI A */ cursorUp(params: number[]): void; - /** CSI B */ cursorDown(params: number[]): void; - /** CSI C */ cursorForward(params: number[]): void; - /** CSI D */ cursorBackward(params: number[]): void; - /** CSI E */ cursorNextLine(params: number[]): void; - /** CSI F */ cursorPrecedingLine(params: number[]): void; - /** CSI G */ cursorCharAbsolute(params: number[]): void; - /** CSI H */ cursorPosition(params: number[]): void; - /** CSI I */ cursorForwardTab(params: number[]): void; - /** CSI J */ eraseInDisplay(params: number[]): void; - /** CSI K */ eraseInLine(params: number[]): void; - /** CSI L */ insertLines(params: number[]): void; - /** CSI M */ deleteLines(params: number[]): void; - /** CSI P */ deleteChars(params: number[]): void; - /** CSI X */ eraseChars(params: number[]): void; - /** CSI ` */ charPosAbsolute(params: number[]): void; - /** CSI a */ HPositionRelative(params: number[]): void; - /** CSI c */ sendDeviceAttributes(params: number[]): void; - /** CSI d */ linePosAbsolute(params: number[]): void; - /** CSI e */ VPositionRelative(params: number[]): void; - /** CSI f */ HVPosition(params: number[]): void; - /** CSI h */ setMode(params: number[]): void; - /** CSI l */ resetMode(params: number[]): void; - /** CSI m */ charAttributes(params: number[]): void; - /** CSI n */ deviceStatus(params: number[]): void; - /** CSI r */ setScrollRegion(params: number[]): void; - /** CSI s */ saveCursor(params: number[]): void; - /** CSI u */ restoreCursor(params: number[]): void; + /** CSI @ */ insertChars(params?: number[]): void; + /** CSI A */ cursorUp(params?: number[]): void; + /** CSI B */ cursorDown(params?: number[]): void; + /** CSI C */ cursorForward(params?: number[]): void; + /** CSI D */ cursorBackward(params?: number[]): void; + /** CSI E */ cursorNextLine(params?: number[]): void; + /** CSI F */ cursorPrecedingLine(params?: number[]): void; + /** CSI G */ cursorCharAbsolute(params?: number[]): void; + /** CSI H */ cursorPosition(params?: number[]): void; + /** CSI I */ cursorForwardTab(params?: number[]): void; + /** CSI J */ eraseInDisplay(params?: number[]): void; + /** CSI K */ eraseInLine(params?: number[]): void; + /** CSI L */ insertLines(params?: number[]): void; + /** CSI M */ deleteLines(params?: number[]): void; + /** CSI P */ deleteChars(params?: number[]): void; + /** CSI S */ scrollUp(params?: number[]): void; + /** CSI T */ scrollDown(params?: number[]): void; + /** CSI X */ eraseChars(params?: number[]): void; + /** CSI Z */ cursorBackwardTab(params?: number[]): void; + /** CSI ` */ charPosAbsolute(params?: number[]): void; + /** CSI a */ HPositionRelative(params?: number[]): void; + /** CSI b */ repeatPrecedingCharacter(params?: number[]): void; + /** CSI c */ sendDeviceAttributes(params?: number[]): void; + /** CSI d */ linePosAbsolute(params?: number[]): void; + /** CSI e */ VPositionRelative(params?: number[]): void; + /** CSI f */ HVPosition(params?: number[]): void; + /** CSI g */ tabClear(params?: number[]): void; + /** CSI h */ setMode(params?: number[]): void; + /** CSI l */ resetMode(params?: number[]): void; + /** CSI m */ charAttributes(params?: number[]): void; + /** CSI n */ deviceStatus(params?: number[]): void; + /** CSI p */ softReset(params?: number[]): void; + /** CSI r */ setScrollRegion(params?: number[]): void; + /** CSI s */ saveCursor(params?: number[]): void; + /** CSI u */ restoreCursor(params?: number[]): void; } diff --git a/src/Parser.ts b/src/Parser.ts index 89d19344..42554117 100644 --- a/src/Parser.ts +++ b/src/Parser.ts @@ -34,33 +34,47 @@ csiParamStateHandler[' '] = (parser) => parser.setPostfix(' '); csiParamStateHandler['\''] = (parser) => parser.setPostfix('\''); csiParamStateHandler[';'] = (parser) => parser.finalizeParam(); -const csiStateHandler: {[key: string]: (handler: IInputHandler, params: number[]) => void} = {}; -csiStateHandler['@'] = (handler, params) => handler.insertChars(params); -csiStateHandler['A'] = (handler, params) => handler.cursorUp(params); -csiStateHandler['B'] = (handler, params) => handler.cursorDown(params); -csiStateHandler['C'] = (handler, params) => handler.cursorForward(params); -csiStateHandler['D'] = (handler, params) => handler.cursorBackward(params); -csiStateHandler['E'] = (handler, params) => handler.cursorNextLine(params); -csiStateHandler['F'] = (handler, params) => handler.cursorPrecedingLine(params); -csiStateHandler['G'] = (handler, params) => handler.cursorCharAbsolute(params); -csiStateHandler['H'] = (handler, params) => handler.cursorPosition(params); -csiStateHandler['I'] = (handler, params) => handler.cursorForwardTab(params); -csiStateHandler['J'] = (handler, params) => handler.eraseInDisplay(params); -csiStateHandler['K'] = (handler, params) => handler.eraseInLine(params); -csiStateHandler['L'] = (handler, params) => handler.insertLines(params); -csiStateHandler['M'] = (handler, params) => handler.deleteLines(params); -csiStateHandler['P'] = (handler, params) => handler.deleteChars(params); -csiStateHandler['X'] = (handler, params) => handler.eraseChars(params); -csiStateHandler['`'] = (handler, params) => handler.charPosAbsolute(params); -csiStateHandler['a'] = (handler, params) => handler.HPositionRelative(params); -csiStateHandler['c'] = (handler, params) => handler.sendDeviceAttributes(params); -csiStateHandler['d'] = (handler, params) => handler.linePosAbsolute(params); -csiStateHandler['e'] = (handler, params) => handler.VPositionRelative(params); -csiStateHandler['f'] = (handler, params) => handler.HVPosition(params); -csiStateHandler['h'] = (handler, params) => handler.setMode(params); -csiStateHandler['l'] = (handler, params) => handler.resetMode(params); -csiStateHandler['m'] = (handler, params) => handler.charAttributes(params); -csiStateHandler['n'] = (handler, params) => handler.deviceStatus(params); +const csiStateHandler: {[key: string]: (handler: IInputHandler, params: number[], prefix: string) => void} = {}; +csiStateHandler['@'] = (handler, params, prefix) => handler.insertChars(params); +csiStateHandler['A'] = (handler, params, prefix) => handler.cursorUp(params); +csiStateHandler['B'] = (handler, params, prefix) => handler.cursorDown(params); +csiStateHandler['C'] = (handler, params, prefix) => handler.cursorForward(params); +csiStateHandler['D'] = (handler, params, prefix) => handler.cursorBackward(params); +csiStateHandler['E'] = (handler, params, prefix) => handler.cursorNextLine(params); +csiStateHandler['F'] = (handler, params, prefix) => handler.cursorPrecedingLine(params); +csiStateHandler['G'] = (handler, params, prefix) => handler.cursorCharAbsolute(params); +csiStateHandler['H'] = (handler, params, prefix) => handler.cursorPosition(params); +csiStateHandler['I'] = (handler, params, prefix) => handler.cursorForwardTab(params); +csiStateHandler['J'] = (handler, params, prefix) => handler.eraseInDisplay(params); +csiStateHandler['K'] = (handler, params, prefix) => handler.eraseInLine(params); +csiStateHandler['L'] = (handler, params, prefix) => handler.insertLines(params); +csiStateHandler['M'] = (handler, params, prefix) => handler.deleteLines(params); +csiStateHandler['P'] = (handler, params, prefix) => handler.deleteChars(params); +csiStateHandler['S'] = (handler, params, prefix) => handler.scrollUp(params); +csiStateHandler['T'] = (handler, params, prefix) => { + if (params.length < 2 && !prefix) { + handler.scrollDown(params); + } +}; +csiStateHandler['X'] = (handler, params, prefix) => handler.eraseChars(params); +csiStateHandler['Z'] = (handler, params, prefix) => handler.cursorBackwardTab(params); +csiStateHandler['`'] = (handler, params, prefix) => handler.charPosAbsolute(params); +csiStateHandler['a'] = (handler, params, prefix) => handler.HPositionRelative(params); +csiStateHandler['b'] = (handler, params, prefix) => handler.repeatPrecedingCharacter(params); +csiStateHandler['c'] = (handler, params, prefix) => handler.sendDeviceAttributes(params); +csiStateHandler['d'] = (handler, params, prefix) => handler.linePosAbsolute(params); +csiStateHandler['e'] = (handler, params, prefix) => handler.VPositionRelative(params); +csiStateHandler['f'] = (handler, params, prefix) => handler.HVPosition(params); +csiStateHandler['g'] = (handler, params, prefix) => handler.tabClear(params); +csiStateHandler['h'] = (handler, params, prefix) => handler.setMode(params); +csiStateHandler['l'] = (handler, params, prefix) => handler.resetMode(params); +csiStateHandler['m'] = (handler, params, prefix) => handler.charAttributes(params); +csiStateHandler['n'] = (handler, params, prefix) => handler.deviceStatus(params); +csiStateHandler['p'] = (handler, params, prefix) => { + switch (prefix) { + case '!': handler.softReset(params); break; + } +}; csiStateHandler['r'] = (handler, params) => handler.setScrollRegion(params); csiStateHandler['s'] = (handler, params) => handler.saveCursor(params); csiStateHandler['u'] = (handler, params) => handler.restoreCursor(params); @@ -355,13 +369,13 @@ export class Parser { // ESC 7 Save Cursor (DECSC). case '7': - this._terminal.saveCursor(); + this._inputHandler.saveCursor(); this.state = ParserState.NORMAL; break; // ESC 8 Restore Cursor (DECRC). case '8': - this._terminal.restoreCursor(); + this._inputHandler.restoreCursor(); this.state = ParserState.NORMAL; break; @@ -549,257 +563,13 @@ export class Parser { this.state = ParserState.CSI; case ParserState.CSI: - this.state = ParserState.NORMAL; - if (ch in csiStateHandler) { - csiStateHandler[ch](this._inputHandler, this._terminal.params); - // Skip below switch as this has handled these codes (eventually everything will be handled here - break; - } - - switch (ch) { - - - /** - * Lesser Used - */ - - // CSI Ps S Scroll up Ps lines (default = 1) (SU). - case 'S': - this._terminal.scrollUp(this._terminal.params); - break; - - // CSI Ps T Scroll down Ps lines (default = 1) (SD). - // CSI Ps ; Ps ; Ps ; Ps ; Ps T - // CSI > Ps; Ps T - case 'T': - // if (this.prefix === '>') { - // this.resetTitleModes(this.params); - // break; - // } - // if (this.params.length > 2) { - // this.initMouseTracking(this.params); - // break; - // } - if (this._terminal.params.length < 2 && !this._terminal.prefix) { - this._terminal.scrollDown(this._terminal.params); - } - break; - - // CSI Ps Z - // Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). - case 'Z': - this._terminal.cursorBackwardTab(this._terminal.params); - break; - - // CSI Ps b Repeat the preceding graphic character Ps times (REP). - case 'b': - this._terminal.repeatPrecedingCharacter(this._terminal.params); - break; - - // CSI Ps g Tab Clear (TBC). - case 'g': - this._terminal.tabClear(this._terminal.params); - break; - - // CSI Pm i Media Copy (MC). - // CSI ? Pm i - // case 'i': - // this.mediaCopy(this.params); - // break; - - // CSI Pm m Character Attributes (SGR). - // CSI > Ps; Ps m - // case 'm': // duplicate - // if (this.prefix === '>') { - // this.setResources(this.params); - // } else { - // this.charAttributes(this.params); - // } - // break; - - // CSI Ps n Device Status Report (DSR). - // CSI > Ps n - // case 'n': // duplicate - // if (this.prefix === '>') { - // this.disableModifiers(this.params); - // } else { - // this.deviceStatus(this.params); - // } - // break; - - // CSI > Ps p Set pointer mode. - // CSI ! p Soft terminal reset (DECSTR). - // CSI Ps$ p - // Request ANSI mode (DECRQM). - // CSI ? Ps$ p - // Request DEC private mode (DECRQM). - // CSI Ps ; Ps " p - case 'p': - switch (this._terminal.prefix) { - // case '>': - // this.setPointerMode(this.params); - // break; - case '!': - this._terminal.softReset(this._terminal.params); - break; - // case '?': - // if (this.postfix === '$') { - // this.requestPrivateMode(this.params); - // } - // break; - // default: - // if (this.postfix === '"') { - // this.setConformanceLevel(this.params); - // } else if (this.postfix === '$') { - // this.requestAnsiMode(this.params); - // } - // break; - } - break; - - // CSI Ps q Load LEDs (DECLL). - // CSI Ps SP q - // CSI Ps " q - // case 'q': - // if (this.postfix === ' ') { - // this.setCursorStyle(this.params); - // break; - // } - // if (this.postfix === '"') { - // this.setCharProtectionAttr(this.params); - // break; - // } - // this.loadLEDs(this.params); - // break; - - // CSI Ps ; Ps r - // Set Scrolling Region [top;bottom] (default = full size of win- - // dow) (DECSTBM). - // CSI ? Pm r - // CSI Pt; Pl; Pb; Pr; Ps$ r - // case 'r': // duplicate - // if (this.prefix === '?') { - // this.restorePrivateValues(this.params); - // } else if (this.postfix === '$') { - // this.setAttrInRectangle(this.params); - // } else { - // this.setScrollRegion(this.params); - // } - // break; - - // CSI s Save cursor (ANSI.SYS). - // CSI ? Pm s - // case 's': // duplicate - // if (this.prefix === '?') { - // this.savePrivateValues(this.params); - // } else { - // this.saveCursor(this.params); - // } - // break; - - // CSI Ps ; Ps ; Ps t - // CSI Pt; Pl; Pb; Pr; Ps$ t - // CSI > Ps; Ps t - // CSI Ps SP t - // case 't': - // if (this.postfix === '$') { - // this.reverseAttrInRectangle(this.params); - // } else if (this.postfix === ' ') { - // this.setWarningBellVolume(this.params); - // } else { - // if (this.prefix === '>') { - // this.setTitleModeFeature(this.params); - // } else { - // this.manipulateWindow(this.params); - // } - // } - // break; - - // CSI u Restore cursor (ANSI.SYS). - // CSI Ps SP u - // case 'u': // duplicate - // if (this.postfix === ' ') { - // this.setMarginBellVolume(this.params); - // } else { - // this.restoreCursor(this.params); - // } - // break; - - // CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v - // case 'v': - // if (this.postfix === '$') { - // this.copyRectagle(this.params); - // } - // break; - - // CSI Pt ; Pl ; Pb ; Pr ' w - // case 'w': - // if (this.postfix === '\'') { - // this.enableFilterRectangle(this.params); - // } - // break; - - // CSI Ps x Request Terminal Parameters (DECREQTPARM). - // CSI Ps x Select Attribute Change Extent (DECSACE). - // CSI Pc; Pt; Pl; Pb; Pr$ x - // case 'x': - // if (this.postfix === '$') { - // this.fillRectangle(this.params); - // } else { - // this.requestParameters(this.params); - // //this.__(this.params); - // } - // break; - - // CSI Ps ; Pu ' z - // CSI Pt; Pl; Pb; Pr$ z - // case 'z': - // if (this.postfix === '\'') { - // this.enableLocatorReporting(this.params); - // } else if (this.postfix === '$') { - // this.eraseRectangle(this.params); - // } - // break; - - // CSI Pm ' { - // CSI Pt; Pl; Pb; Pr$ { - // case '{': - // if (this.postfix === '\'') { - // this.setLocatorEvents(this.params); - // } else if (this.postfix === '$') { - // this.selectiveEraseRectangle(this.params); - // } - // break; - - // CSI Ps ' | - // case '|': - // if (this.postfix === '\'') { - // this.requestLocatorPosition(this.params); - // } - // break; - - // CSI P m SP } - // Insert P s Column(s) (default = 1) (DECIC), VT420 and up. - // case '}': - // if (this.postfix === ' ') { - // this.insertColumns(this.params); - // } - // break; - - // CSI P m SP ~ - // Delete P s Column(s) (default = 1) (DECDC), VT420 and up - // case '~': - // if (this.postfix === ' ') { - // this.deleteColumns(this.params); - // } - // break; - - default: - this._terminal.error('Unknown CSI code: %s.', ch); - break; + csiStateHandler[ch](this._inputHandler, this._terminal.params, this._terminal.prefix); + } else { + this._terminal.error('Unknown CSI code: %s.', ch); } + this.state = ParserState.NORMAL; this._terminal.prefix = ''; this._terminal.postfix = ''; break; diff --git a/src/xterm.js b/src/xterm.js index 30cb7286..b3ecdf8d 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -2315,470 +2315,6 @@ Terminal.prototype.tabSet = function() { this.tabs[this.x] = true; }; - -/** - * CSI - */ - - -/** - * Additions - */ - - -/** - * Lesser Used - */ - - - -/** - * CSI Ps S Scroll up Ps lines (default = 1) (SU). - */ -Terminal.prototype.scrollUp = function(params) { - var param = params[0] || 1; - while (param--) { - this.lines.splice(this.ybase + this.scrollTop, 1); - this.lines.splice(this.ybase + this.scrollBottom, 0, this.blankLine()); - } - // this.maxRange(); - this.updateRange(this.scrollTop); - this.updateRange(this.scrollBottom); -}; - - -/** - * CSI Ps T Scroll down Ps lines (default = 1) (SD). - */ -Terminal.prototype.scrollDown = function(params) { - var param = params[0] || 1; - while (param--) { - this.lines.splice(this.ybase + this.scrollBottom, 1); - this.lines.splice(this.ybase + this.scrollTop, 0, this.blankLine()); - } - // this.maxRange(); - this.updateRange(this.scrollTop); - this.updateRange(this.scrollBottom); -}; - - -/** - * CSI Ps ; Ps ; Ps ; Ps ; Ps T - * Initiate highlight mouse tracking. Parameters are - * [func;startx;starty;firstrow;lastrow]. See the section Mouse - * Tracking. - */ -Terminal.prototype.initMouseTracking = function(params) { - // Relevant: DECSET 1001 -}; - - -/** - * CSI > Ps; Ps T - * Reset one or more features of the title modes to the default - * value. Normally, "reset" disables the feature. It is possi- - * ble to disable the ability to reset features by compiling a - * different default for the title modes into xterm. - * Ps = 0 -> Do not set window/icon labels using hexadecimal. - * Ps = 1 -> Do not query window/icon labels using hexadeci- - * mal. - * Ps = 2 -> Do not set window/icon labels using UTF-8. - * Ps = 3 -> Do not query window/icon labels using UTF-8. - * (See discussion of "Title Modes"). - */ -Terminal.prototype.resetTitleModes = function(params) { - ; -}; - - -/** - * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). - */ -Terminal.prototype.cursorBackwardTab = function(params) { - var param = params[0] || 1; - while (param--) { - this.x = this.prevStop(); - } -}; - - -/** - * CSI Ps b Repeat the preceding graphic character Ps times (REP). - */ -Terminal.prototype.repeatPrecedingCharacter = function(params) { - var param = params[0] || 1 - , line = this.lines.get(this.ybase + this.y) - , ch = line[this.x - 1] || [this.defAttr, ' ', 1]; - - while (param--) line[this.x++] = ch; -}; - - -/** - * CSI Ps g Tab Clear (TBC). - * Ps = 0 -> Clear Current Column (default). - * Ps = 3 -> Clear All. - * Potentially: - * Ps = 2 -> Clear Stops on Line. - * http://vt100.net/annarbor/aaa-ug/section6.html - */ -Terminal.prototype.tabClear = function(params) { - var param = params[0]; - if (param <= 0) { - delete this.tabs[this.x]; - } else if (param === 3) { - this.tabs = {}; - } -}; - - -/** - * CSI Pm i Media Copy (MC). - * Ps = 0 -> Print screen (default). - * Ps = 4 -> Turn off printer controller mode. - * Ps = 5 -> Turn on printer controller mode. - * CSI ? Pm i - * Media Copy (MC, DEC-specific). - * Ps = 1 -> Print line containing cursor. - * Ps = 4 -> Turn off autoprint mode. - * Ps = 5 -> Turn on autoprint mode. - * Ps = 1 0 -> Print composed display, ignores DECPEX. - * Ps = 1 1 -> Print all pages. - */ -Terminal.prototype.mediaCopy = function(params) { - ; -}; - - -/** - * CSI > Ps; Ps m - * Set or reset resource-values used by xterm to decide whether - * to construct escape sequences holding information about the - * modifiers pressed with a given key. The first parameter iden- - * tifies the resource to set/reset. The second parameter is the - * value to assign to the resource. If the second parameter is - * omitted, the resource is reset to its initial value. - * Ps = 1 -> modifyCursorKeys. - * Ps = 2 -> modifyFunctionKeys. - * Ps = 4 -> modifyOtherKeys. - * If no parameters are given, all resources are reset to their - * initial values. - */ -Terminal.prototype.setResources = function(params) { - ; -}; - - -/** - * CSI > Ps n - * Disable modifiers which may be enabled via the CSI > Ps; Ps m - * sequence. This corresponds to a resource value of "-1", which - * cannot be set with the other sequence. The parameter identi- - * fies the resource to be disabled: - * Ps = 1 -> modifyCursorKeys. - * Ps = 2 -> modifyFunctionKeys. - * Ps = 4 -> modifyOtherKeys. - * If the parameter is omitted, modifyFunctionKeys is disabled. - * When modifyFunctionKeys is disabled, xterm uses the modifier - * keys to make an extended sequence of functions rather than - * adding a parameter to each function key to denote the modi- - * fiers. - */ -Terminal.prototype.disableModifiers = function(params) { - ; -}; - - -/** - * CSI > Ps p - * Set resource value pointerMode. This is used by xterm to - * decide whether to hide the pointer cursor as the user types. - * Valid values for the parameter: - * Ps = 0 -> never hide the pointer. - * Ps = 1 -> hide if the mouse tracking mode is not enabled. - * Ps = 2 -> always hide the pointer. If no parameter is - * given, xterm uses the default, which is 1 . - */ -Terminal.prototype.setPointerMode = function(params) { - ; -}; - - -/** - * CSI ! p Soft terminal reset (DECSTR). - * http://vt100.net/docs/vt220-rm/table4-10.html - */ -Terminal.prototype.softReset = function(params) { - this.cursorHidden = false; - this.insertMode = false; - this.originMode = false; - this.wraparoundMode = false; // autowrap - this.applicationKeypad = false; // ? - this.viewport.syncScrollArea(); - this.applicationCursor = false; - this.scrollTop = 0; - this.scrollBottom = this.rows - 1; - this.curAttr = this.defAttr; - this.x = this.y = 0; // ? - this.charset = null; - this.glevel = 0; // ?? - this.charsets = [null]; // ?? -}; - - -/** - * CSI Ps$ p - * Request ANSI mode (DECRQM). For VT300 and up, reply is - * CSI Ps; Pm$ y - * where Ps is the mode number as in RM, and Pm is the mode - * value: - * 0 - not recognized - * 1 - set - * 2 - reset - * 3 - permanently set - * 4 - permanently reset - */ -Terminal.prototype.requestAnsiMode = function(params) { - ; -}; - - -/** - * CSI ? Ps$ p - * Request DEC private mode (DECRQM). For VT300 and up, reply is - * CSI ? Ps; Pm$ p - * where Ps is the mode number as in DECSET, Pm is the mode value - * as in the ANSI DECRQM. - */ -Terminal.prototype.requestPrivateMode = function(params) { - ; -}; - - -/** - * CSI Ps ; Ps " p - * Set conformance level (DECSCL). Valid values for the first - * parameter: - * Ps = 6 1 -> VT100. - * Ps = 6 2 -> VT200. - * Ps = 6 3 -> VT300. - * Valid values for the second parameter: - * Ps = 0 -> 8-bit controls. - * Ps = 1 -> 7-bit controls (always set for VT100). - * Ps = 2 -> 8-bit controls. - */ -Terminal.prototype.setConformanceLevel = function(params) { - ; -}; - - -/** - * CSI Ps q Load LEDs (DECLL). - * Ps = 0 -> Clear all LEDS (default). - * Ps = 1 -> Light Num Lock. - * Ps = 2 -> Light Caps Lock. - * Ps = 3 -> Light Scroll Lock. - * Ps = 2 1 -> Extinguish Num Lock. - * Ps = 2 2 -> Extinguish Caps Lock. - * Ps = 2 3 -> Extinguish Scroll Lock. - */ -Terminal.prototype.loadLEDs = function(params) { - ; -}; - - -/** - * CSI Ps SP q - * Set cursor style (DECSCUSR, VT520). - * Ps = 0 -> blinking block. - * Ps = 1 -> blinking block (default). - * Ps = 2 -> steady block. - * Ps = 3 -> blinking underline. - * Ps = 4 -> steady underline. - */ -Terminal.prototype.setCursorStyle = function(params) { - ; -}; - - -/** - * CSI Ps " q - * Select character protection attribute (DECSCA). Valid values - * for the parameter: - * Ps = 0 -> DECSED and DECSEL can erase (default). - * Ps = 1 -> DECSED and DECSEL cannot erase. - * Ps = 2 -> DECSED and DECSEL can erase. - */ -Terminal.prototype.setCharProtectionAttr = function(params) { - ; -}; - - -/** - * CSI ? Pm r - * Restore DEC Private Mode Values. The value of Ps previously - * saved is restored. Ps values are the same as for DECSET. - */ -Terminal.prototype.restorePrivateValues = function(params) { - ; -}; - - -/** - * CSI Pt; Pl; Pb; Pr; Ps$ r - * Change Attributes in Rectangular Area (DECCARA), VT400 and up. - * Pt; Pl; Pb; Pr denotes the rectangle. - * Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7. - * NOTE: xterm doesn't enable this code by default. - */ -Terminal.prototype.setAttrInRectangle = function(params) { - var t = params[0] - , l = params[1] - , b = params[2] - , r = params[3] - , attr = params[4]; - - var line - , i; - - for (; t < b + 1; t++) { - line = this.lines.get(this.ybase + t); - for (i = l; i < r; i++) { - line[i] = [attr, line[i][1]]; - } - } - - // this.maxRange(); - this.updateRange(params[0]); - this.updateRange(params[2]); -}; - - -/** - * CSI Pc; Pt; Pl; Pb; Pr$ x - * Fill Rectangular Area (DECFRA), VT420 and up. - * Pc is the character to use. - * Pt; Pl; Pb; Pr denotes the rectangle. - * NOTE: xterm doesn't enable this code by default. - */ -Terminal.prototype.fillRectangle = function(params) { - var ch = params[0] - , t = params[1] - , l = params[2] - , b = params[3] - , r = params[4]; - - var line - , i; - - for (; t < b + 1; t++) { - line = this.lines.get(this.ybase + t); - for (i = l; i < r; i++) { - line[i] = [line[i][0], String.fromCharCode(ch)]; - } - } - - // this.maxRange(); - this.updateRange(params[1]); - this.updateRange(params[3]); -}; - - -/** - * CSI Ps ; Pu ' z - * Enable Locator Reporting (DECELR). - * Valid values for the first parameter: - * Ps = 0 -> Locator disabled (default). - * Ps = 1 -> Locator enabled. - * Ps = 2 -> Locator enabled for one report, then disabled. - * The second parameter specifies the coordinate unit for locator - * reports. - * Valid values for the second parameter: - * Pu = 0 <- or omitted -> default to character cells. - * Pu = 1 <- device physical pixels. - * Pu = 2 <- character cells. - */ -Terminal.prototype.enableLocatorReporting = function(params) { - var val = params[0] > 0; - //this.mouseEvents = val; - //this.decLocator = val; -}; - - -/** - * CSI Pt; Pl; Pb; Pr$ z - * Erase Rectangular Area (DECERA), VT400 and up. - * Pt; Pl; Pb; Pr denotes the rectangle. - * NOTE: xterm doesn't enable this code by default. - */ -Terminal.prototype.eraseRectangle = function(params) { - var t = params[0] - , l = params[1] - , b = params[2] - , r = params[3]; - - var line - , i - , ch; - - ch = [this.eraseAttr(), ' ', 1]; // xterm? - - for (; t < b + 1; t++) { - line = this.lines.get(this.ybase + t); - for (i = l; i < r; i++) { - line[i] = ch; - } - } - - // this.maxRange(); - this.updateRange(params[0]); - this.updateRange(params[2]); -}; - - -/** - * CSI P m SP } - * Insert P s Column(s) (default = 1) (DECIC), VT420 and up. - * NOTE: xterm doesn't enable this code by default. - */ -Terminal.prototype.insertColumns = function() { - var param = params[0] - , l = this.ybase + this.rows - , ch = [this.eraseAttr(), ' ', 1] // xterm? - , i; - - while (param--) { - for (i = this.ybase; i < l; i++) { - this.lines.get(i).splice(this.x + 1, 0, ch); - this.lines.get(i).pop(); - } - } - - this.maxRange(); -}; - - -/** - * CSI P m SP ~ - * Delete P s Column(s) (default = 1) (DECDC), VT420 and up - * NOTE: xterm doesn't enable this code by default. - */ -Terminal.prototype.deleteColumns = function() { - var param = params[0] - , l = this.ybase + this.rows - , ch = [this.eraseAttr(), ' ', 1] // xterm? - , i; - - while (param--) { - for (i = this.ybase; i < l; i++) { - this.lines.get(i).splice(this.x, 1); - this.lines.get(i).push(ch); - } - } - - this.maxRange(); -}; - /** * Helpers */