about summary refs log tree commit diff stats
path: root/repl.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-31 23:44:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-01 00:11:31 -0700
commit87fbfc2d4607ff31d5b0b023f41d8ba439dd5958 (patch)
treec511ff6d2ea35991dca67f905559d81d6004b5a3 /repl.mu
parent4bbd3ded0b767ae0919551776e4c17189140e735 (diff)
downloadmu-87fbfc2d4607ff31d5b0b023f41d8ba439dd5958.tar.gz
1518 - still horribly broken
Just figured out why a first keystroke of backspace was sending me out
for a spin: run_interactive needs all early exits that don't actually
run anything to increment the current_step_index(). FML, this is lousy..
Diffstat (limited to 'repl.mu')
-rw-r--r--repl.mu35
1 files changed, 34 insertions, 1 deletions
diff --git a/repl.mu b/repl.mu
index ace65309..dce9b033 100644
--- a/repl.mu
+++ b/repl.mu
@@ -9,7 +9,16 @@ recipe main [
   {
     inst:address:array:character, 0:literal/real-keyboard, 0:literal/real-screen <- read-instruction 0:literal/real-keyboard, 0:literal/real-screen
     break-unless inst:address:array:character
-    0:literal/real-screen <- print-string 0:literal/real-screen, inst:address:array:character
+#?     0:literal/real-screen <- print-string 0:literal/real-screen, inst:address:array:character
+    run-interactive inst:address:array:character
+#?     print-character-to-display 97:literal/a
+#?     print-character-to-display 97:literal/a
+#?     print-character-to-display 97:literal/a
+#?     print-character-to-display 10:literal/newline
+    # assume run-interactive printed on the current line
+#?     $print [a7] #? 1
+    move-cursor-down-on-display
+    clear-line-on-display  # just to refresh the screen
     loop
   }
   return-to-console
@@ -77,6 +86,9 @@ recipe slurp-regular-characters [
   characters-slurped:number <- copy 0:literal
   {
     +next-character
+#?     $print [a0 #? 1
+#? ] #? 1
+#?     move-cursor-down-on-display #? 1
     # read character
     c:character, k:address:keyboard <- wait-for-key k:address:keyboard
     # quit?
@@ -115,19 +127,40 @@ recipe slurp-regular-characters [
     print-character x:address:screen, c:character  # default color
     # append
     result:address:buffer <- buffer-append result:address:buffer, c:character
+#?     $print [a1 #? 1
+#? ] #? 1
+#?     move-cursor-down-on-display #? 1
     # backspace? decrement and maybe return
     {
+#?       $print [a2 #? 1
+#? ] #? 1
+#?       move-cursor-down-on-display #? 1
       backspace?:boolean <- equal c:character, 8:literal/backspace
       break-unless backspace?:boolean
+#?       $print [a3 #? 1
+#? ] #? 1
+#?       move-cursor-down-on-display #? 1
       characters-slurped:number <- subtract characters-slurped:number, 1:literal
       {
+#?         $print [a4 #? 1
+#? ] #? 1
+#?         move-cursor-down-on-display #? 1
         done?:boolean <- lesser-or-equal characters-slurped:number, 0:literal
         break-unless done?:boolean
+#?         $print [a5 #? 1
+#? ] #? 1
+#?         move-cursor-down-on-display #? 1
         trace [app], [slurp-regular-characters: too many backspaces; returning]
+#?         $print [a6 #? 1
+#? ] #? 1
+#?         move-cursor-down-on-display #? 1
         reply result:address:buffer, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2
       }
       loop +next-character:label
     }
+#?     $print [a9 #? 1
+#? ] #? 1
+#?     move-cursor-down-on-display #? 1
     # otherwise increment
     characters-slurped:number <- add characters-slurped:number, 1:literal
     # done with this instruction?