# HG changeset patch # User John "Elwin" Edwards # Date 1390794962 28800 # Node ID 1d3cfe10974a25ea1adf445d52b36320ef44cc75 # Parent 6758d832c10c914b20c8889515d9055118e01fe3 termemu.js: implement cursor hiding. diff -r 6758d832c10c -r 1d3cfe10974a termemu.js --- a/termemu.js Sat Jan 25 22:10:01 2014 -0800 +++ b/termemu.js Sun Jan 26 19:56:02 2014 -0800 @@ -37,6 +37,7 @@ this.fg = src.fg; this.bg = src.bg; this.cset = src.cset; + this.visible = src.visible; } else { this.x = 0; @@ -47,6 +48,7 @@ this.fg = null; this.bg = null; this.cset = "B"; + this.visible = true; } return; } @@ -268,6 +270,8 @@ /* 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 @@ /* 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 @@ 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(); }