diff --git a/termemu.js b/termemu.js index 43334f7..5e4ad1a 100644 --- a/termemu.js +++ b/termemu.js @@ -37,6 +37,7 @@ function Cursor(src) { this.fg = src.fg; this.bg = src.bg; this.cset = src.cset; + this.visible = src.visible; } else { this.x = 0; @@ -47,6 +48,7 @@ function Cursor(src) { this.fg = null; this.bg = null; this.cset = "B"; + this.visible = true; } return; } @@ -268,6 +270,8 @@ var termemu = { /* Swaps the text and background colors of the active location. */ /* This will change when other cursor styles are supported. */ /* 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 && 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]; @@ -1015,6 +1019,14 @@ var termemu = { /* Wraparound ON is the only mode implemented. */ 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) { this.saveCursor(); } @@ -1042,6 +1054,17 @@ var termemu = { if (params[i] == 1) { 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) { this.restoreCursor(); }