about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-19 09:10:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-19 09:10:29 -0700
commit1521e4e32f7a5ddd3629006b3e46501ed22d91a5 (patch)
treecc6de148bdf3d3b78caa48ef51ce31ce0b6cad3b /edit
parent2655ae726e607ba4caa88c088ffb77e50753aead (diff)
downloadmu-1521e4e32f7a5ddd3629006b3e46501ed22d91a5.tar.gz
2975
Clean up this helper before we start redoing sandbox menubars.
Diffstat (limited to 'edit')
-rw-r--r--edit/001-editor.mu9
-rw-r--r--edit/002-typing.mu2
-rw-r--r--edit/004-programming-environment.mu8
-rw-r--r--edit/005-sandbox.mu2
4 files changed, 11 insertions, 10 deletions
diff --git a/edit/001-editor.mu b/edit/001-editor.mu
index 06c5a8dc..1d4b4ac2 100644
--- a/edit/001-editor.mu
+++ b/edit/001-editor.mu
@@ -172,7 +172,7 @@ def render screen:address:screen, editor:address:editor-data -> last-row:number,
         before-cursor <- prev curr
       }
       # clear rest of line in this window
-      clear-line-delimited screen, column, right
+      clear-line-until screen, right
       # skip to next line
       row <- add row, 1
       column <- copy left
@@ -222,9 +222,10 @@ def render screen:address:screen, editor:address:editor-data -> last-row:number,
   return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1
 ]
 
-def clear-line-delimited screen:address:screen, column:number, right:number -> screen:address:screen [
+def clear-line-until screen:address:screen, right:number -> screen:address:screen [
   local-scope
   load-ingredients
+  _, column:number <- cursor-position screen
   space:character <- copy 32/space
   bg-color:number, bg-color-found?:boolean <- next-ingredient
   {
@@ -252,7 +253,7 @@ def clear-screen-from screen:address:screen, row:number, column:number, left:num
   }
   # if not, go the slower route
   screen <- move-cursor screen, row, column
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   clear-rest-of-screen screen, row, left, right
   return screen/same-as-ingredient:0
 ]
@@ -267,7 +268,7 @@ def clear-rest-of-screen screen:address:screen, row:number, left:number, right:n
     at-bottom-of-screen?:boolean <- greater-or-equal row, screen-height
     break-if at-bottom-of-screen?
     screen <- move-cursor screen, row, left
-    clear-line-delimited screen, left, right
+    clear-line-until screen, right
     row <- add row, 1
     loop
   }
diff --git a/edit/002-typing.mu b/edit/002-typing.mu
index 88079641..47743404 100644
--- a/edit/002-typing.mu
+++ b/edit/002-typing.mu
@@ -273,7 +273,7 @@ def editor-render screen:address:screen, editor:address:editor-data -> screen:ad
   left:number <- get *editor, left:offset
   right:number <- get *editor, right:offset
   row:number, column:number <- render screen, editor
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   row <- add row, 1
   draw-horizontal screen, row, left, right, 9480/horizontal-dotted
   row <- add row, 1
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu
index e7509bf7..a432d565 100644
--- a/edit/004-programming-environment.mu
+++ b/edit/004-programming-environment.mu
@@ -411,7 +411,7 @@ def render-recipes screen:address:screen, env:address:programming-environment-da
   left:number <- get *recipes, left:offset
   right:number <- get *recipes, right:offset
   row:number, column:number, screen <- render screen, recipes
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   row <- add row, 1
   <render-recipe-components-end>
   # draw dotted line after recipes
@@ -428,7 +428,7 @@ def render-sandbox-side screen:address:screen, env:address:programming-environme
   left:number <- get *current-sandbox, left:offset
   right:number <- get *current-sandbox, right:offset
   row:number, column:number, screen, current-sandbox <- render screen, current-sandbox
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   row <- add row, 1
   # draw solid line after code (you'll see why in later layers)
   draw-horizontal screen, row, left, right, 9473/horizontal
@@ -507,7 +507,7 @@ def render screen:address:screen, s:address:array:character, left:number, right:
     loop
   }
   was-at-left?:boolean <- equal column, left
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   {
     break-if was-at-left?
     row <- add row, 1
@@ -570,7 +570,7 @@ def render-code screen:address:screen, s:address:array:character, left:number, r
     loop
   }
   was-at-left?:boolean <- equal column, left
-  clear-line-delimited screen, column, right
+  clear-line-until screen, right
   {
     break-if was-at-left?
     row <- add row, 1
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index f331c356..c00669ea 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -269,7 +269,7 @@ def render-sandboxes screen:address:screen, sandbox:address:sandbox-data, left:n
     row <- add row, 1
     screen <- move-cursor screen, row, left
     print screen, idx, 240/dark-grey
-    clear-line-delimited screen, left, right
+    clear-line-until screen, right
     delete-icon:character <- copy 120/x
     print screen, delete-icon, 245/grey
     # save menu row so we can detect clicks to it later