summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-10-09 15:33:05 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-10-09 15:33:05 +0200
commit092a47f2d3d33f7529d8e3433ee39c525fa672db (patch)
tree81bcf8ef6c2f20720d5dfce5c4de1e264d2435de
parent406c109aeca67d1d88589d8ba09d66605ba55a07 (diff)
Fix console cursor display in Chrome
-rw-r--r--js/codeq/console.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/codeq/console.js b/js/codeq/console.js
index 566a2b7..2cc7efd 100644
--- a/js/codeq/console.js
+++ b/js/codeq/console.js
@@ -864,13 +864,15 @@
aKeyIsDown = false, // whether a key is currently pressed: if it's not and there is input, then we got a paste via mouse
cursorBlinkRate = (options && options.cursorBlinkRate) || 750, // default: 750 ms
+ cursorVisible = false,
blinkTimer = null,
- renderCursor = function () {
+ renderCursor = function (show) {
+ if (show !== undefined) cursorVisible = show;
if (blinkTimer !== null) {
clearInterval(blinkTimer);
blinkTimer = null;
}
- if (jqInput.is(':focus')) {
+ if (cursorVisible) {
jqContent.find('.cq-con-cursor').addClass('inverted');
if ((typeof cursorBlinkRate === 'number') && (cursorBlinkRate >= 50)) { // have some sense of sanity
blinkTimer = setInterval(function () {
@@ -946,8 +948,8 @@
aKeyIsDown = false;
});
- jqInput.on('blur focus', function () {
- renderCursor();
+ jqInput.on('blur focus', function (evt) {
+ renderCursor(evt.type === 'focus');
});
if ('oninput' in jqInput[0]) {