UNPKG

845 BJavaScriptView Raw
1'use strict';
2
3module.exports = function (Terminal) {
4 Terminal.prototype.cursorBlink = function() {
5 if (Terminal.focus !== this) return;
6 this.cursorState ^= 1;
7 this.refresh(this.y, this.y);
8 };
9
10 Terminal.prototype.showCursor = function() {
11 if (!this.cursorState) {
12 this.cursorState = 1;
13 this.refresh(this.y, this.y);
14 } else {
15 // Temporarily disabled:
16 // this.refreshBlink();
17 }
18 };
19
20 Terminal.prototype.startBlink = function() {
21 if (!Terminal.cursorBlink) return;
22 var self = this;
23 this._blinker = function() {
24 self.cursorBlink();
25 };
26 this._blink = setInterval(this._blinker, 500);
27 };
28
29 Terminal.prototype.refreshBlink = function() {
30 if (!Terminal.cursorBlink) return;
31 clearInterval(this._blink);
32 this._blink = setInterval(this._blinker, 500);
33 };
34};