about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-25 09:25:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-25 09:25:49 -0700
commit48bb86278826a08e2550f2c49e695167fb137957 (patch)
tree7428588a5270d1c867706ec722d2103e4d4401bb
parentec3aa9e03f1c97e5dd904a448f3b73386a6a4e67 (diff)
downloadmu-48bb86278826a08e2550f2c49e695167fb137957.tar.gz
1655 - first attempt at smooth refresh: hide-cursor
But it doesn't work, because moving the cursor inside 'render' also
starts displaying it again.
-rw-r--r--070display.cc20
-rw-r--r--071print.mu26
-rw-r--r--edit.mu1
3 files changed, 47 insertions, 0 deletions
diff --git a/070display.cc b/070display.cc
index 9cec82ca..db205d63 100644
--- a/070display.cc
+++ b/070display.cc
@@ -219,6 +219,26 @@ case DISPLAY_HEIGHT: {
   break;
 }
 
+:(before "End Primitive Recipe Declarations")
+HIDE_CURSOR_ON_DISPLAY,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["hide-cursor-on-display"] = HIDE_CURSOR_ON_DISPLAY;
+:(before "End Primitive Recipe Implementations")
+case HIDE_CURSOR_ON_DISPLAY: {
+  tb_set_cursor(TB_HIDE_CURSOR, TB_HIDE_CURSOR);
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+SHOW_CURSOR_ON_DISPLAY,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["show-cursor-on-display"] = SHOW_CURSOR_ON_DISPLAY;
+:(before "End Primitive Recipe Implementations")
+case SHOW_CURSOR_ON_DISPLAY: {
+  tb_set_cursor(Display_row, Display_column);
+  break;
+}
+
 //:: Keyboard/mouse management
 
 :(before "End Primitive Recipe Declarations")
diff --git a/071print.mu b/071print.mu
index 9fcfb018..a5cb191b 100644
--- a/071print.mu
+++ b/071print.mu
@@ -533,6 +533,32 @@ recipe screen-height [
   reply height:number
 ]
 
+recipe hide-cursor [
+  default-space:address:array:location <- new location:type, 30:literal
+  x:address:screen <- next-ingredient
+  # if x exists (not real display), do nothing
+  {
+    break-unless x:address:screen
+    reply x:address:screen
+  }
+  # otherwise, real screen
+  hide-cursor-on-display
+  reply x:address:screen
+]
+
+recipe show-cursor [
+  default-space:address:array:location <- new location:type, 30:literal
+  x:address:screen <- next-ingredient
+  # if x exists (not real display), do nothing
+  {
+    break-unless x:address:screen
+    reply x:address:screen
+  }
+  # otherwise, real screen
+  show-cursor-on-display
+  reply x:address:screen
+]
+
 recipe print-string [
   default-space:address:array:location <- new location:type, 30:literal
   x:address:screen <- next-ingredient
diff --git a/edit.mu b/edit.mu
index 2ca7aeca..e8daedc2 100644
--- a/edit.mu
+++ b/edit.mu
@@ -157,6 +157,7 @@ recipe render [
   left:number <- get editor:address:editor-data/deref, left:offset
   screen-height:number <- screen-height screen:address
   right:number <- get editor:address:editor-data/deref, right:offset
+  hide-cursor screen:address
   # traversing editor
   curr:address:duplex-list <- get editor:address:editor-data/deref, top-of-screen:offset
   curr:address:duplex-list <- next-duplex curr:address:duplex-list