summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]) {