From f969b8b19cd1726f9d9291b923d13e8800a3321e Mon Sep 17 00:00:00 2001 From: zodiac Date: Mon, 9 Feb 2009 17:15:32 +0000 Subject: [PATCH] Fixed cursor hiding and showing. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@58 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- shellinabox/vt100.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index d5ba1c1..49211d7 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -1289,7 +1289,7 @@ VT100.prototype.scrollRegion = function(x, y, w, h, incX, incY, style) { // Determine original cursor position. Hide cursor temporarily to avoid // visual artifacts. - var visible = this.hideCursor(); + var hidden = this.hideCursor(); var cx = this.cursorX; var cy = this.cursorY; var console = this.console[this.currentScreen]; @@ -1396,7 +1396,7 @@ VT100.prototype.scrollRegion = function(x, y, w, h, incX, incY, style) { this.cursorHeight + 1; // Move cursor back to its original position - visible ? this.showCursor(cx, cy) : this.putString(cx, cy, '', undefined); + hidden ? this.showCursor(cx, cy) : this.putString(cx, cy, '', undefined); } }; @@ -2304,7 +2304,8 @@ VT100.prototype.setMode = function(state) { case 7: this.autoWrapMode = state; break; case 1000: case 9: this.mouseReporting = state; break; - case 25: if (state) { this.showCursor(); } + case 25: this.cursorNeedsShowing = state; + if (state) { this.showCursor(); } else { this.hideCursor(); } break; case 1047: case 1049: @@ -2827,7 +2828,7 @@ VT100.prototype.renderString = function(s, showCursor) { }; VT100.prototype.vt100 = function(s) { - var visible = this.hideCursor(); + this.cursorNeedsShowing = this.hideCursor(); this.respondString = ''; var lineBuf = ''; for (var i = 0; i < s.length; i++) { @@ -2918,8 +2919,8 @@ VT100.prototype.vt100 = function(s) { } } if (lineBuf) { - this.renderString(lineBuf, true); - } else if (visible) { + this.renderString(lineBuf, this.cursorNeedsShowing); + } else if (this.cursorNeedsShowing) { this.showCursor(); } return this.respondString;