From fa2df8eb2a4d154731b648974a3c87d13ba205ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lio=20A=2E=20Heckert?= Date: Wed, 12 Aug 2015 14:15:23 -0300 Subject: [PATCH] Better cursor blink Allows to format cursor off style instead only removal. Example: .terminal-cursor.off { visibility: visible; opacity: 0.5; } --- src/term.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/term.js b/src/term.js index 982a1cc..db5a8b5 100644 --- a/src/term.js +++ b/src/term.js @@ -664,6 +664,10 @@ Terminal.insertStyle = function(document, bg, fg) { + '.terminal-cursor {\n' + ' color: ' + bg + ';\n' + ' background: ' + fg + ';\n' + + '}\n' + + '\n' + + '.terminal-cursor.off {\n' + + ' visibility: hidden;\n' + '}\n'; // var out = ''; @@ -1221,7 +1225,6 @@ Terminal.prototype.refresh = function(start, end) { out = ''; if (y === this.y - && this.cursorState && (this.ydisp === this.ybase || this.selectMode) && !this.cursorHidden) { x = this.x; @@ -1244,7 +1247,11 @@ Terminal.prototype.refresh = function(start, end) { } if (data !== this.defAttr) { if (data === -1) { - out += ''; + if (this.cursorState) + var currCssClass = 'terminal-cursor on' + else + var currCssClass = 'terminal-cursor off' + out += ''; } else { out += '