about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-22 23:40:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-22 23:40:16 -0700
commitf2d7ad5dd9d58ac861875461de3e1aded13c7859 (patch)
treefc068969ed44e641777a9177b7ff4cf479e94c6a
parent60d205aa33049b3ccc23dfca9a13e460cdcabd4f (diff)
downloadmu-f2d7ad5dd9d58ac861875461de3e1aded13c7859.tar.gz
1622 - done migrating to console interface
But still feels rough:
  Variable names are still funky: 'k' and 'm'.
  Field names still not copacetic: single-touch-event. Foolish
  consistencies..
-rw-r--r--edit.mu28
1 files changed, 14 insertions, 14 deletions
diff --git a/edit.mu b/edit.mu
index 87721689..aea92acc 100644
--- a/edit.mu
+++ b/edit.mu
@@ -273,22 +273,22 @@ scenario editor-initially-wraps-long-lines [
 recipe event-loop [
   default-space:address:array:location <- new location:type, 30:literal
   screen:address <- next-ingredient
-  events:address <- next-ingredient
+  console:address <- next-ingredient
   editor:address:editor-data <- next-ingredient
   {
     +next-event
-    e:event, events:address, found?:boolean, quit?:boolean <- read-event events:address
+    e:event, console:address, found?:boolean, quit?:boolean <- read-event console:address
     loop-unless found?:boolean
     break-if quit?:boolean  # only in tests
     trace [app], [next-event]
     {
-      m:address:mouse-event <- maybe-convert e:event, mouse:variant
-      break-unless m:address:mouse-event
-      editor:address:editor-data <- move-cursor-in-editor editor:address:editor-data, m:address:mouse-event
+      m:address:single-touch-event <- maybe-convert e:event, pointer:variant
+      break-unless m:address:single-touch-event
+      editor:address:editor-data <- move-cursor-in-editor editor:address:editor-data, m:address:single-touch-event
       loop +next-event:label
     }
-    k:address:keyboard-event <- maybe-convert e:event, keyboard:variant
-    assert k:address:keyboard-event, [event was of unknown type; neither keyboard nor mouse]
+    k:address:character <- maybe-convert e:event, text:variant
+    assert k:address:character, [event was of unknown type; neither keyboard nor mouse]
     loop
   }
 ]
@@ -296,21 +296,21 @@ recipe event-loop [
 recipe move-cursor-in-editor [
   default-space:address:array:location <- new location:type, 30:literal
   editor:address:editor-data <- next-ingredient
-  m:address:mouse-event <- next-ingredient
+  m:address:single-touch-event <- next-ingredient
   row:address:number <- get-address editor:address:editor-data/deref, cursor-row:offset
-  row:address:number/deref <- get m:address:mouse-event/deref, row:offset
+  row:address:number/deref <- get m:address:single-touch-event/deref, row:offset
   column:address:number <- get-address editor:address:editor-data/deref, cursor-column:offset
-  column:address:number/deref <- get m:address:mouse-event/deref, column:offset
+  column:address:number/deref <- get m:address:single-touch-event/deref, column:offset
   # todo: adjust 'cursor' pointer into editor data
 ]
 
 scenario editor-handles-empty-event-queue [
   assume-screen 10:literal/width, 5:literal/height
-  assume-events []
+  assume-console []
   run [
     s:address:array:character <- new [abc]
     editor:address:editor-data <- new-editor s:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
-    event-loop screen:address, events:address, editor:address:editor-data
+    event-loop screen:address, console:address, editor:address:editor-data
   ]
   screen-should-contain [
     .abc       .
@@ -320,13 +320,13 @@ scenario editor-handles-empty-event-queue [
 
 scenario editor-handles-mouse-clicks [
   assume-screen 10:literal/width, 5:literal/height
-  assume-events [
+  assume-console [
     left-click 0, 1
   ]
   run [
     1:address:array:character <- new [abc]
     2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
-    event-loop screen:address, events:address, 2:address:editor-data
+    event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
   ]