termemu.js: implement cursor hiding.

This commit is contained in:
John "Elwin" Edwards 2014-01-26 19:56:02 -08:00
parent d5b4cb5de0
commit de69f47fc1

View file

@ -37,6 +37,7 @@ function Cursor(src) {
this.fg = src.fg; this.fg = src.fg;
this.bg = src.bg; this.bg = src.bg;
this.cset = src.cset; this.cset = src.cset;
this.visible = src.visible;
} }
else { else {
this.x = 0; this.x = 0;
@ -47,6 +48,7 @@ function Cursor(src) {
this.fg = null; this.fg = null;
this.bg = null; this.bg = null;
this.cset = "B"; this.cset = "B";
this.visible = true;
} }
return; return;
} }
@ -268,6 +270,8 @@ var termemu = {
/* Swaps the text and background colors of the active location. */ /* Swaps the text and background colors of the active location. */
/* This will change when other cursor styles are supported. */ /* This will change when other cursor styles are supported. */
/* Check: the cursor might be offscreen if it was resized. */ /* Check: the cursor might be offscreen if it was resized. */
if (!this.c.visible)
return;
if (this.c.x != null && this.c.y != null && this.c.x >= 0 && if (this.c.x != null && this.c.y != null && this.c.x >= 0 &&
this.c.x < this.w && this.c.y >= 0 && this.c.y < this.h) { this.c.x < this.w && this.c.y >= 0 && this.c.y < this.h) {
var oldcell = this.screen.childNodes[this.c.y].childNodes[this.c.x]; var oldcell = this.screen.childNodes[this.c.y].childNodes[this.c.x];
@ -1015,6 +1019,14 @@ var termemu = {
/* Wraparound ON is the only mode implemented. */ /* Wraparound ON is the only mode implemented. */
debug(0, "Wraparound mode"); debug(0, "Wraparound mode");
} }
else if (params[i] == 25) {
/* Show the cursor. */
if (!this.c.visible) {
this.c.visible = true;
this.flipCursor();
}
debug(0, "Showing cursor");
}
else if (params[i] == 1048) { else if (params[i] == 1048) {
this.saveCursor(); this.saveCursor();
} }
@ -1042,6 +1054,17 @@ var termemu = {
if (params[i] == 1) { if (params[i] == 1) {
keyHexCodes.appCursor(false); keyHexCodes.appCursor(false);
} }
else if (params[i] == 12) {
debug(0, "Stopping blinking cursor");
}
else if (params[i] == 25) {
/* Hide the cursor. */
if (this.c.visible) {
this.flipCursor();
this.c.visible = false;
}
debug(0, "Hiding cursor");
}
else if (params[i] == 1048) { else if (params[i] == 1048) {
this.restoreCursor(); this.restoreCursor();
} }