diff --git a/src/xterm.css b/src/xterm.css index 5a325ed..1f49d69 100644 --- a/src/xterm.css +++ b/src/xterm.css @@ -57,6 +57,21 @@ background-color: transparent; } +.terminal .terminal-cursor.blinking { + animation: blink-cursor 1.2s infinite step-end; +} + +@keyframes blink-cursor { + 0% { + background-color: #fff; + color: #000; + } + 50% { + background-color: transparent; + color: #FFF; + } +} + /* * Determine default colors for xterm.js */ diff --git a/src/xterm.js b/src/xterm.js index 1ac384c..a11c81e 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -765,9 +765,6 @@ // Ensure there is a Terminal.focus. this.focus(); - // Start blinking the cursor. - this.startBlink(); - on(this.element, 'mouseup', function() { var selection = document.getSelection(), collapsed = selection.isCollapsed, @@ -1250,7 +1247,11 @@ } if (data !== this.defAttr) { if (data === -1) { - out += ''; + out += ''; } else { var classNames = []; @@ -1363,32 +1364,13 @@ this.emit('refresh', {element: this.element, start: start, end: end}); }; - Terminal.prototype._cursorBlink = function() { - if (document.activeElement !== this.element) return; - this.cursorState ^= 1; - this.refresh(this.y, this.y); - }; - Terminal.prototype.showCursor = function() { if (!this.cursorState) { this.cursorState = 1; this.refresh(this.y, this.y); - } else { - this.refreshBlink(); } }; - Terminal.prototype.startBlink = function() { - if (!this.cursorBlink) return; - this._blink = setInterval(this._cursorBlink.bind(this), 500); - }; - - Terminal.prototype.refreshBlink = function() { - if (!this.cursorBlink) return; - clearInterval(this._blink); - this._blink = setInterval(this._cursorBlink.bind(this), 500); - }; - Terminal.prototype.scroll = function() { var row;