From d44123cabaa730c778a0e2644c75dbfba6a7ab30 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 12 Jun 2015 22:34:45 -0700 Subject: 1556 --- html/edit.mu.html | 92 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 20 deletions(-) (limited to 'html/edit.mu.html') diff --git a/html/edit.mu.html b/html/edit.mu.html index 8251e997..16ba4cac 100644 --- a/html/edit.mu.html +++ b/html/edit.mu.html @@ -17,9 +17,9 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } .Comment { color: #8080ff; } .Constant { color: #008080; } .Special { color: #ff6060; } -.Identifier { color: #008080; } -.muRecipe { color: #ff8700; } .CommentedCode { color: #6c6c6c; } +.muControl { color: #804000; } +.muRecipe { color: #ff8700; } --> @@ -32,41 +32,93 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; }
 recipe main [
-  default-space:address:array:location <- new location:type, 30:literal
+  default-space:address:array:location <- new location:type, 30:literal
   switch-to-display
-  draw-bounding-box 0:literal/screen, 5:literal, 5:literal, 30:literal, 45:literal
+  width:number <- display-width
+  {
+    wide-enough?:boolean <- greater-than width:number, 100:literal
+    break-if wide-enough?:boolean
+    return-to-console
+    assert wide-enough?:boolean, [screen too narrow; we don't support less than 100 characters yet]
+  }
+  divider:number, _ <- divide-with-remainder width:number, 2:literal
+  draw-column 0:literal/screen, divider:number
+  x:address:array:character <- new [1:integer <- add 2:literal, 2:literal]
+  y:address:array:character <- edit x:address:array:character, 0:literal/screen, 0:literal, 0:literal, 5:literal, divider:number
+#?   draw-bounding-box 0:literal/screen, 0:literal, 0:literal, 5:literal, divider:number
+  left:number <- add divider:number, 1:literal
+  y:address:array:character <- edit 0:literal, 0:literal/screen, 0:literal, left:number, 2:literal, width:number
+  move-cursor 0:literal/screen, 0:literal, 0:literal
   wait-for-key-from-keyboard
   return-to-console
 ]
 
+recipe draw-column [
+  default-space:address:array:location <- new location:type, 30:literal
+  screen:address <- next-ingredient
+  col:number <- next-ingredient
+  curr:number <- copy 0:literal
+  max:number <- screen-height screen:address
+  {
+    continue?:boolean <- lesser-than curr:number, max:number
+    break-unless continue?:boolean
+    move-cursor screen:address, curr:number, col:number
+    print-character screen:address, 9474:literal/vertical, 245:literal/grey
+    curr:number <- add curr:number, 1:literal
+    loop
+  }
+  move-cursor screen:address, 0:literal, 0:literal
+]
+
+recipe edit [
+  default-space:address:array:location <- new location:type, 30:literal
+  in:address:array:character <- next-ingredient
+  screen:address <- next-ingredient
+  top:number <- next-ingredient
+  left:number <- next-ingredient
+  bottom:number <- next-ingredient
+  right:number <- next-ingredient
+  # draw bottom boundary
+  curr:number <- copy left:number
+  {
+    continue?:boolean <- lesser-than curr:number, right:number
+    break-unless continue?:boolean
+    move-cursor screen:address, bottom:number, curr:number
+    print-character screen:address, 9472:literal/vertical, 245:literal/grey
+    curr:number <- add curr:number, 1:literal
+    loop
+  }
+  move-cursor screen:address, top:number, left:number
+]
+
 recipe draw-bounding-box [
-  default-space:address:array:location <- new location:type, 30:literal
-  screen:address <- next-ingredient
+  default-space:address:array:location <- new location:type, 30:literal
+  screen:address <- next-ingredient
   # sanity-check the box bounds
-  top:number <- next-ingredient
+  top:number <- next-ingredient
   {
     out?:boolean <- lesser-than top:number, 0:literal
-    break-unless out?:boolean
+    break-unless out?:boolean
     top:number <- copy 0:literal
   }
-  left:number <- next-ingredient
+  left:number <- next-ingredient
   {
     out?:boolean <- lesser-than left:number, 0:literal
-    break-unless out?:boolean
+    break-unless out?:boolean
     left:number <- copy 0:literal
   }
-  bottom:number <- next-ingredient
+  bottom:number <- next-ingredient
   {
     height:number <- screen-height screen:address
     out?:boolean <- greater-or-equal bottom:number, height:number
-    break-unless out?:boolean
+    break-unless out?:boolean
     bottom:number <- subtract height:number, 1:literal
   }
-  right:number <- next-ingredient
+  right:number <- next-ingredient
   {
     width:number <- screen-width screen:address
     out?:boolean <- greater-or-equal right:number, width:number
-    break-unless out?:boolean
+    break-unless out?:boolean
     right:number <- subtract width:number, 1:literal
   }
 #?   print-integer screen:address, bottom:number
@@ -78,10 +130,10 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; }
   x:number <- add left:number, 1:literal  # exclude corner
   {
     continue?:boolean <- lesser-than x:number, right:number
-    break-unless continue?:boolean
+    break-unless continue?:boolean
     print-character screen:address, 9472:literal/horizontal, 245:literal/grey
     x:number <- add x:number, 1:literal
-    loop
+    loop
   }
   print-character screen:address, 9488:literal/down-left, 245:literal/grey
   # bottom border
@@ -90,23 +142,23 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; }
   x:number <- add left:number, 1:literal  # exclude corner
   {
     continue?:boolean <- lesser-than x:number, right:number
-    break-unless continue?:boolean
+    break-unless continue?:boolean
     print-character screen:address, 9472:literal/horizontal, 245:literal/grey
     x:number <- add x:number, 1:literal
-    loop
+    loop
   }
   print-character screen:address, 9496:literal/up-left, 245:literal/grey
   # left and right borders
   x:number <- add top:number, 1:literal  # exclude corner
   {
     continue?:boolean <- lesser-than x:number, bottom:number
-    break-unless continue?:boolean
+    break-unless continue?:boolean
     move-cursor screen:address, x:number, left:number
     print-character screen:address, 9474:literal/vertical, 245:literal/grey
     move-cursor screen:address, x:number, right:number
     print-character screen:address, 9474:literal/vertical, 245:literal/grey
     x:number <- add x:number, 1:literal
-    loop
+    loop
   }
   # position cursor inside box
   move-cursor screen:address, top:number, left:number
-- 
cgit 1.4.1-2-gfad0