From 092a47f2d3d33f7529d8e3433ee39c525fa672db Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 9 Oct 2015 15:33:05 +0200 Subject: Fix console cursor display in Chrome --- js/codeq/console.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js/codeq/console.js') 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]) { -- cgit v1.2.1