mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-11-01 12:35:56 +00:00
Use CSS animations
This commit is contained in:
parent
253babff62
commit
0d803ac895
@ -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
|
||||
*/
|
||||
|
||||
28
src/xterm.js
28
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 += '<span class="reverse-video terminal-cursor">';
|
||||
out += '<span class="reverse-video terminal-cursor';
|
||||
if (this.cursorBlink) {
|
||||
out += ' blinking';
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user