VT100.prototype.toggleCursorBlinking = function() {
this.blinkingCursor = !this.blinkingCursor;
+ this.animateCursor('bright');
};
VT100.prototype.about = function() {
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
this.checkComposedKeys(event);
this.lastKeyPressedEvent = undefined;
this.lastKeyDownEvent = undefined;
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyDownEvent) {
// If we already processed the key on keydown, do not process it
// again here. Ideally, the browser should not even have generated a
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyPressedEvent) {
// The compose key on Linux occasionally confuses the browser and keeps
// inserting bogus characters into the input field, even if just a regular
return false;
};
-VT100.prototype.animateCursor = function(inactive) {
+VT100.prototype.animateCursor = function(state) {
+ if (state != undefined) {
+ this.cursor.className = state;
+
+ // Reset the blink timer when a state is explicitly defined.
+ if (this.cursorInterval) {
+ clearInterval(this.cursorInterval);
+ this.cursorInterval = undefined;
+ }
+ } else {
+ if (this.cursor.className != 'inactive') {
+ if (this.blinkingCursor && this.cursor.className == 'bright') {
+ this.cursor.className = 'dim';
+ } else {
+ this.cursor.className = 'bright';
+ }
+ }
+ }
+
if (!this.cursorInterval) {
this.cursorInterval = setInterval(
function(vt100) {
}
}(this), 500);
}
- if (inactive != undefined || this.cursor.className != 'inactive') {
- if (inactive) {
- this.cursor.className = 'inactive';
- } else {
- if (this.blinkingCursor) {
- this.cursor.className = this.cursor.className == 'bright'
- ? 'dim' : 'bright';
- } else {
- this.cursor.className = 'bright';
- }
- }
- }
};
VT100.prototype.blurCursor = function() {
- this.animateCursor(true);
+ this.animateCursor('inactive');
};
VT100.prototype.focusCursor = function() {
- this.animateCursor(false);
+ this.animateCursor('bright');
};
VT100.prototype.flashScreen = function() {
VT100.prototype.toggleCursorBlinking = function() {
this.blinkingCursor = !this.blinkingCursor;
+ this.animateCursor('bright');
};
VT100.prototype.about = function() {
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
this.checkComposedKeys(event);
this.lastKeyPressedEvent = undefined;
this.lastKeyDownEvent = undefined;
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyDownEvent) {
// If we already processed the key on keydown, do not process it
// again here. Ideally, the browser should not even have generated a
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyPressedEvent) {
// The compose key on Linux occasionally confuses the browser and keeps
// inserting bogus characters into the input field, even if just a regular
return false;
};
-VT100.prototype.animateCursor = function(inactive) {
+VT100.prototype.animateCursor = function(state) {
+ if (state != undefined) {
+ this.cursor.className = state;
+
+ // Reset the blink timer when a state is explicitly defined.
+ if (this.cursorInterval) {
+ clearInterval(this.cursorInterval);
+ this.cursorInterval = undefined;
+ }
+ } else {
+ if (this.cursor.className != 'inactive') {
+ if (this.blinkingCursor && this.cursor.className == 'bright') {
+ this.cursor.className = 'dim';
+ } else {
+ this.cursor.className = 'bright';
+ }
+ }
+ }
+
if (!this.cursorInterval) {
this.cursorInterval = setInterval(
function(vt100) {
}
}(this), 500);
}
- if (inactive != undefined || this.cursor.className != 'inactive') {
- if (inactive) {
- this.cursor.className = 'inactive';
- } else {
- if (this.blinkingCursor) {
- this.cursor.className = this.cursor.className == 'bright'
- ? 'dim' : 'bright';
- } else {
- this.cursor.className = 'bright';
- }
- }
- }
};
VT100.prototype.blurCursor = function() {
- this.animateCursor(true);
+ this.animateCursor('inactive');
};
VT100.prototype.focusCursor = function() {
- this.animateCursor(false);
+ this.animateCursor('bright');
};
VT100.prototype.flashScreen = function() {
VT100.prototype.toggleCursorBlinking = function() {
this.blinkingCursor = !this.blinkingCursor;
+ this.animateCursor('bright');
};
VT100.prototype.about = function() {
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
this.checkComposedKeys(event);
this.lastKeyPressedEvent = undefined;
this.lastKeyDownEvent = undefined;
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyDownEvent) {
// If we already processed the key on keydown, do not process it
// again here. Ideally, the browser should not even have generated a
// (event.shiftKey ? 'S' : '') + (event.ctrlKey ? 'C' : '') +
// (event.altKey ? 'A' : '') + (event.metaKey ? 'M' : '') : '') +
// '\r\n');
+
+ // Keep the cursor lit when there is user activity.
+ this.animateCursor('bright');
+
if (this.lastKeyPressedEvent) {
// The compose key on Linux occasionally confuses the browser and keeps
// inserting bogus characters into the input field, even if just a regular
return false;
};
-VT100.prototype.animateCursor = function(inactive) {
+VT100.prototype.animateCursor = function(state) {
+ if (state != undefined) {
+ this.cursor.className = state;
+
+ // Reset the blink timer when a state is explicitly defined.
+ if (this.cursorInterval) {
+ clearInterval(this.cursorInterval);
+ this.cursorInterval = undefined;
+ }
+ } else {
+ if (this.cursor.className != 'inactive') {
+ if (this.blinkingCursor && this.cursor.className == 'bright') {
+ this.cursor.className = 'dim';
+ } else {
+ this.cursor.className = 'bright';
+ }
+ }
+ }
+
if (!this.cursorInterval) {
this.cursorInterval = setInterval(
function(vt100) {
}
}(this), 500);
}
- if (inactive != undefined || this.cursor.className != 'inactive') {
- if (inactive) {
- this.cursor.className = 'inactive';
- } else {
- if (this.blinkingCursor) {
- this.cursor.className = this.cursor.className == 'bright'
- ? 'dim' : 'bright';
- } else {
- this.cursor.className = 'bright';
- }
- }
- }
};
VT100.prototype.blurCursor = function() {
- this.animateCursor(true);
+ this.animateCursor('inactive');
};
VT100.prototype.focusCursor = function() {
- this.animateCursor(false);
+ this.animateCursor('bright');
};
VT100.prototype.flashScreen = function() {