Merge pull request #121 from Tyriar/119_fix_cursor_blink
Fix cursor blinking when enabled
This commit is contained in:
@@ -57,6 +57,21 @@
|
|||||||
background-color: transparent;
|
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
|
* Determine default colors for xterm.js
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-28
@@ -765,9 +765,6 @@
|
|||||||
// Ensure there is a Terminal.focus.
|
// Ensure there is a Terminal.focus.
|
||||||
this.focus();
|
this.focus();
|
||||||
|
|
||||||
// Start blinking the cursor.
|
|
||||||
this.startBlink();
|
|
||||||
|
|
||||||
on(this.element, 'mouseup', function() {
|
on(this.element, 'mouseup', function() {
|
||||||
var selection = document.getSelection(),
|
var selection = document.getSelection(),
|
||||||
collapsed = selection.isCollapsed,
|
collapsed = selection.isCollapsed,
|
||||||
@@ -1250,7 +1247,11 @@
|
|||||||
}
|
}
|
||||||
if (data !== this.defAttr) {
|
if (data !== this.defAttr) {
|
||||||
if (data === -1) {
|
if (data === -1) {
|
||||||
out += '<span class="reverse-video terminal-cursor">';
|
out += '<span class="reverse-video terminal-cursor';
|
||||||
|
if (this.cursorBlink) {
|
||||||
|
out += ' blinking';
|
||||||
|
}
|
||||||
|
out += '">';
|
||||||
} else {
|
} else {
|
||||||
var classNames = [];
|
var classNames = [];
|
||||||
|
|
||||||
@@ -1363,37 +1364,13 @@
|
|||||||
this.emit('refresh', {element: this.element, start: start, end: end});
|
this.emit('refresh', {element: this.element, start: start, end: end});
|
||||||
};
|
};
|
||||||
|
|
||||||
Terminal.prototype._cursorBlink = function() {
|
|
||||||
if (Terminal.focus !== this) return;
|
|
||||||
this.cursorState ^= 1;
|
|
||||||
this.refresh(this.y, this.y);
|
|
||||||
};
|
|
||||||
|
|
||||||
Terminal.prototype.showCursor = function() {
|
Terminal.prototype.showCursor = function() {
|
||||||
if (!this.cursorState) {
|
if (!this.cursorState) {
|
||||||
this.cursorState = 1;
|
this.cursorState = 1;
|
||||||
this.refresh(this.y, this.y);
|
this.refresh(this.y, this.y);
|
||||||
} else {
|
|
||||||
// Temporarily disabled:
|
|
||||||
// this.refreshBlink();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Terminal.prototype.startBlink = function() {
|
|
||||||
if (!this.cursorBlink) return;
|
|
||||||
var self = this;
|
|
||||||
this._blinker = function() {
|
|
||||||
self._cursorBlink();
|
|
||||||
};
|
|
||||||
this._blink = setInterval(this._blinker, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
Terminal.prototype.refreshBlink = function() {
|
|
||||||
if (!this.cursorBlink) return;
|
|
||||||
clearInterval(this._blink);
|
|
||||||
this._blink = setInterval(this._blinker, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
Terminal.prototype.scroll = function() {
|
Terminal.prototype.scroll = function() {
|
||||||
var row;
|
var row;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user