changeset 150:1d3cfe10974a

termemu.js: implement cursor hiding.
author John "Elwin" Edwards
date Sun, 26 Jan 2014 19:56:02 -0800
parents 6758d832c10c
children 9f9bc41d5006 c4a32007d2dc
files termemu.js
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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();
         }