about summary refs log tree commit diff stats
path: root/sandbox/004-programming-environment.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-12 07:32:46 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-12 07:34:07 -0700
commit43f634adb0eda2fc0377423e5c5b2a7d8f087780 (patch)
tree9413077799113f237d12684aed955caf1f35c983 /sandbox/004-programming-environment.mu
parentcd0577aeb288f57aaccd93bf88874499e3e4af1d (diff)
downloadmu-43f634adb0eda2fc0377423e5c5b2a7d8f087780.tar.gz
3852
Bugfix of commit 3850 for the sandbox/ app. I'd hoped to just quickly move
past this ugly approach, but a cleaner way is more involved than I thought.

This way is ugly partly because I'm introducing a bunch of conditionals
without testing them. One or more of my additions may well be hiding bugs.
Or I may need to add them in a few other places.

The clean way is to update the fake screen model to accurately mimic the
new real screen, where out of bounds prints aren't silently ignored, and
where scrolling is a fact of life.
Diffstat (limited to 'sandbox/004-programming-environment.mu')
-rw-r--r--sandbox/004-programming-environment.mu7
1 files changed, 7 insertions, 0 deletions
diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu
index 1ebb696d..a29324b0 100644
--- a/sandbox/004-programming-environment.mu
+++ b/sandbox/004-programming-environment.mu
@@ -208,11 +208,18 @@ def render-sandbox-side screen:&:screen, env:&:environment, {render-editor: (rec
   left:num <- get *current-sandbox, left:offset
   right:num <- get *current-sandbox, right:offset
   row:num, column:num, screen, current-sandbox <- call render-editor, screen, current-sandbox
+  screen-height:num <- screen-height screen
+  space-left?:bool <- lesser-than row, screen-height
+  return-unless space-left?
   clear-line-until screen, right
   row <- add row, 1
+  space-left? <- lesser-than row, screen-height
+  return-unless space-left?
   # draw solid line after code (you'll see why in later layers)
   draw-horizontal screen, row, left, right
   row <- add row, 1
+  space-left? <- lesser-than row, screen-height
+  return-unless space-left?
   clear-screen-from screen, row, left, left, right
 ]