]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/InputHandler.ts
Merge remote-tracking branch 'upstream/master' into 459_parser__on_460
[mirror_xterm.js.git] / src / InputHandler.ts
1 import { IInputHandler, ITerminal } from './Interfaces';
2
3 export class InputHandler implements IInputHandler {
4 // TODO: We want to type _terminal when it's pulled into TS
5 constructor(private _terminal: any) { }
6
7 public bell(): void {
8 if (!this._terminal.visualBell) {
9 return;
10 }
11 this._terminal.element.style.borderColor = 'white';
12 setTimeout(() => this._terminal.element.style.borderColor = '', 10);
13 if (this._terminal.popOnBell) {
14 this._terminal.focus();
15 }
16 }
17
18 public lineFeed(): void {
19 if (this._terminal.convertEol) {
20 this._terminal.x = 0;
21 }
22 this._terminal.y++;
23 if (this._terminal.y > this._terminal.scrollBottom) {
24 this._terminal.y--;
25 this._terminal.scroll();
26 }
27 }
28
29 public carriageReturn(): void {
30 this._terminal.x = 0;
31 }
32
33 public backspace(): void {
34 if (this._terminal.x > 0) {
35 this._terminal.x--;
36 }
37 }
38
39 public tab(): void {
40 this._terminal.x = this._terminal.nextStop();
41 }
42
43 public shiftOut(): void {
44 this._terminal.setgLevel(1);
45 }
46
47 public shiftIn(): void {
48 this._terminal.setgLevel(0);
49 }
50 }