about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-13 20:47:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-13 20:48:16 -0700
commit27ec57de4cc5eddd80f9faf198c0cebc345c1949 (patch)
treef85ec7a45b31f71925775c2a11ef6ff34765cf15
parent6f4ce8654319ec2d5099d5d01a63d8e2e5ea0c6f (diff)
downloadmu-27ec57de4cc5eddd80f9faf198c0cebc345c1949.tar.gz
3858
Lose the ability to hide the cursor. If we want to stop buffering the screen
in termbox, it needs to go.

What's more, it has no tests.
-rw-r--r--080display.cc30
-rw-r--r--081print.mu16
-rw-r--r--termbox/termbox.c7
-rw-r--r--termbox/termbox.h6
4 files changed, 3 insertions, 56 deletions
diff --git a/080display.cc b/080display.cc
index 5de87688..26b17926 100644
--- a/080display.cc
+++ b/080display.cc
@@ -328,36 +328,6 @@ case DISPLAY_HEIGHT: {
 }
 
 :(before "End Primitive Recipe Declarations")
-HIDE_CURSOR_ON_DISPLAY,
-:(before "End Primitive Recipe Numbers")
-put(Recipe_ordinal, "hide-cursor-on-display", HIDE_CURSOR_ON_DISPLAY);
-:(before "End Primitive Recipe Checks")
-case HIDE_CURSOR_ON_DISPLAY: {
-  break;
-}
-:(before "End Primitive Recipe Implementations")
-case HIDE_CURSOR_ON_DISPLAY: {
-  CHECK_SCREEN;
-  tb_set_cursor(TB_HIDE_CURSOR, TB_HIDE_CURSOR);
-  break;
-}
-
-:(before "End Primitive Recipe Declarations")
-SHOW_CURSOR_ON_DISPLAY,
-:(before "End Primitive Recipe Numbers")
-put(Recipe_ordinal, "show-cursor-on-display", SHOW_CURSOR_ON_DISPLAY);
-:(before "End Primitive Recipe Checks")
-case SHOW_CURSOR_ON_DISPLAY: {
-  break;
-}
-:(before "End Primitive Recipe Implementations")
-case SHOW_CURSOR_ON_DISPLAY: {
-  CHECK_SCREEN;
-  tb_set_cursor(Display_row, Display_column);
-  break;
-}
-
-:(before "End Primitive Recipe Declarations")
 HIDE_DISPLAY,
 :(before "End Primitive Recipe Numbers")
 put(Recipe_ordinal, "hide-display", HIDE_DISPLAY);
diff --git a/081print.mu b/081print.mu
index f1c8c8bb..b778948e 100644
--- a/081print.mu
+++ b/081print.mu
@@ -597,22 +597,6 @@ def screen-height screen:&:screen -> height:num [
   height <- display-height
 ]
 
-def hide-cursor screen:&:screen -> screen:&:screen [
-  local-scope
-  load-ingredients
-  return-if screen  # fake screen; do nothing
-  # real screen
-  hide-cursor-on-display
-]
-
-def show-cursor screen:&:screen -> screen:&:screen [
-  local-scope
-  load-ingredients
-  return-if screen  # fake screen; do nothing
-  # real screen
-  show-cursor-on-display
-]
-
 def hide-screen screen:&:screen -> screen:&:screen [
   local-scope
   load-ingredients
diff --git a/termbox/termbox.c b/termbox/termbox.c
index 0e0669ad..1ae275ce 100644
--- a/termbox/termbox.c
+++ b/termbox/termbox.c
@@ -30,7 +30,6 @@ struct cellbuf {
 };
 
 #define CELL(buf, x, y) (buf)->cells[(y) * (buf)->width + (x)]
-#define IS_CURSOR_HIDDEN(cx, cy) (cx == -1 || cy == -1)
 #define LAST_COORD_INIT -1
 
 static struct termios orig_tios;
@@ -202,8 +201,7 @@ void tb_present() {
       x += w;
     }
   }
-  if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y))
-    write_cursor(cursor_x, cursor_y);
+  write_cursor(cursor_x, cursor_y);
   bytebuffer_flush(&output_buffer, inout);
 }
 
@@ -212,8 +210,7 @@ void tb_set_cursor(int cx, int cy)
   assert(termw != -1);
   cursor_x = cx;
   cursor_y = cy;
-  if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y))
-    write_cursor(cursor_x, cursor_y);
+  write_cursor(cursor_x, cursor_y);
 }
 
 void tb_change_cell(int x, int y, uint32_t ch, uint16_t fg, uint16_t bg)
diff --git a/termbox/termbox.h b/termbox/termbox.h
index 4c5d327a..64c1c4eb 100644
--- a/termbox/termbox.h
+++ b/termbox/termbox.h
@@ -60,12 +60,8 @@ struct tb_cell *tb_cell_buffer();
 void tb_clear(void);
 void tb_set_clear_attributes(uint16_t fg, uint16_t bg);
 
-/* Move the cursor. Upper-left character is (0, 0).
- */
+/* Move the cursor. Upper-left character is (0, 0). */
 void tb_set_cursor(int cx, int cy);
-/* To hide the cursor, call tb_set_cursor(TB_HIDE_CURSOR, TB_HIDE_CURSOR).
- * Cursor starts out hidden. */
-#define TB_HIDE_CURSOR -1
 
 /* Modify a specific cell of the screen. Don't forget to call tb_present() to
  * commit your changes. */