about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--edit/004-programming-environment.mu23
-rw-r--r--edit/005-sandbox.mu10
-rw-r--r--edit/009-sandbox-trace.mu3
3 files changed, 19 insertions, 17 deletions
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu
index 4718ca82..495b183a 100644
--- a/edit/004-programming-environment.mu
+++ b/edit/004-programming-environment.mu
@@ -431,16 +431,12 @@ recipe render-recipes [
   row:number, column:number, screen <- render screen, recipes
   clear-line-delimited screen, column, right
   recipe-warnings:address:array:character <- get *env, recipe-warnings:offset
+  row <- add row, 1
   {
     # print any warnings
     break-unless recipe-warnings
     row, screen <- render-string screen, recipe-warnings, left, right, 1/red, row
   }
-  {
-    # no warnings? move to next line
-    break-if recipe-warnings
-    row <- add row, 1
-  }
   # draw dotted line after recipes
   draw-horizontal screen, row, left, right, 9480/horizontal-dotted
   row <- add row, 1
@@ -487,9 +483,8 @@ recipe update-cursor [
 ]
 
 # row, screen <- render-string screen:address, s:address:array:character, left:number, right:number, color:number, row:number
-# move cursor at start of next line
 # print a string 's' to 'editor' in 'color' starting at 'row'
-# clear rest of last line, but don't move cursor to next line
+# clear rest of last line, move cursor to next line
 recipe render-string [
   local-scope
   screen:address <- next-ingredient
@@ -498,7 +493,6 @@ recipe render-string [
   right:number <- next-ingredient
   color:number <- next-ingredient
   row:number <- next-ingredient
-  row <- add row, 1
   reply-unless s, row/same-as-ingredient:5, screen/same-as-ingredient:0
   column:number <- copy left
   screen <- move-cursor screen, row, column
@@ -545,7 +539,13 @@ recipe render-string [
     column <- add column, 1
     loop
   }
+  was-at-left?:boolean <- equal column, left
   clear-line-delimited screen, column, right
+  {
+    break-if was-at-left?
+    row <- add row, 1
+  }
+  move-cursor row, left
   reply row/same-as-ingredient:5, screen/same-as-ingredient:0
 ]
 
@@ -558,7 +558,6 @@ recipe render-code-string [
   left:number <- next-ingredient
   right:number <- next-ingredient
   row:number <- next-ingredient
-  row <- add row, 1
   reply-unless s, row/same-as-ingredient:4, screen/same-as-ingredient:0
   color:number <- copy 7/white
   column:number <- copy left
@@ -607,7 +606,13 @@ recipe render-code-string [
     column <- add column, 1
     loop
   }
+  was-at-left?:boolean <- equal column, left
   clear-line-delimited screen, column, right
+  {
+    break-if was-at-left?
+    row <- add row, 1
+  }
+  move-cursor row, left
   reply row/same-as-ingredient:4, screen/same-as-ingredient:0
 ]
 
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 10a3fffb..69e5d901 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -16,7 +16,7 @@ container sandbox-data [
   expected-response:address:array:character
   # coordinates to track clicks
   starting-row-on-screen:number
-  code-ending-row-on-screen:number
+  code-ending-row-on-screen:number  # past end of code
   response-starting-row-on-screen:number
   display-trace?:boolean
   screen:address:screen  # prints in the sandbox go here
@@ -257,6 +257,8 @@ recipe render-sandboxes [
   starting-row:address:number <- get-address *sandbox, starting-row-on-screen:offset
   *starting-row <- copy row
   # render sandbox contents
+  row <- add row, 1
+  screen <- move-cursor screen, row, left
   sandbox-data:address:array:character <- get *sandbox, data:offset
   row, screen <- render-code-string screen, sandbox-data, left, right, row
   code-ending-row:address:number <- get-address *sandbox, code-ending-row-on-screen:offset
@@ -281,7 +283,7 @@ recipe render-sandboxes [
   {
     break-if sandbox-warnings
     break-unless empty-screen?
-    *response-starting-row <- add row, 1
+    *response-starting-row <- copy row
     <render-sandbox-response>
     row, screen <- render-string screen, sandbox-response, left, right, 245/grey, row
   }
@@ -338,14 +340,10 @@ recipe render-screen [
   left:number <- next-ingredient
   right:number <- next-ingredient
   row:number <- next-ingredient
-  row <- add row, 1
   reply-unless s, row/same-as-ingredient:4, screen/same-as-ingredient:0
   # print 'screen:'
   header:address:array:character <- new [screen:]
-  row <- subtract row, 1  # compensate for render-string below
   row <- render-string screen, header, left, right, 245/grey, row
-  # newline
-  row <- add row, 1
   screen <- move-cursor screen, row, left
   # start printing s
   column:number <- copy left
diff --git a/edit/009-sandbox-trace.mu b/edit/009-sandbox-trace.mu
index 7b5dd4e2..f10f3fd0 100644
--- a/edit/009-sandbox-trace.mu
+++ b/edit/009-sandbox-trace.mu
@@ -170,7 +170,7 @@ recipe find-click-in-sandbox-code [
   }
   # return sandbox if click is in its code region
   code-ending-row:number <- get *sandbox, code-ending-row-on-screen:offset
-  click-above-response?:boolean <- lesser-or-equal click-row, code-ending-row
+  click-above-response?:boolean <- lesser-than click-row, code-ending-row
   start:number <- get *sandbox, starting-row-on-screen:offset
   click-below-menu?:boolean <- greater-than click-row, start
   click-on-sandbox-code?:boolean <- and click-above-response?, click-below-menu?
@@ -189,6 +189,5 @@ after <render-sandbox-results> [
     sandbox-trace:address:array:character <- get *sandbox, trace:offset
     break-unless sandbox-trace  # nothing to print; move on
     row, screen <- render-string, screen, sandbox-trace, left, right, 245/grey, row
-    row <- subtract row, 1  # trim the trailing newline that's always present
   }
 ]