about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-30 10:21:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-30 10:21:39 -0700
commit21c7573cabbb0be8951c877048344edf9051535f (patch)
treedfc100fc3725df3c0f3306b1e4fdb3802b0d0f90
parent06a0bf49d459fe4842d58c5542083de6eb3412ce (diff)
downloadmu-21c7573cabbb0be8951c877048344edf9051535f.tar.gz
1684
-rw-r--r--edit.mu38
1 files changed, 33 insertions, 5 deletions
diff --git a/edit.mu b/edit.mu
index 83918f80..be6c006b 100644
--- a/edit.mu
+++ b/edit.mu
@@ -296,12 +296,10 @@ recipe render [
 #?     $print [render Ω: cursor adjusted to after ], new-prev:character, [(], cursor-row:address:number/deref, [, ], cursor-column:address:number/deref, [)
 #? ] #? 1
   }
-  # clear rest of screen
-  # don't initialize column; we'll clear the first row from wherever we
-  # left off rendering.
 #?   $print [clearing ], row:number, [ ], column:number, [ ], right:number, [ 
 #? ] #? 2
   {
+    # clear rest of current line
     done?:boolean <- greater-or-equal row:number, screen-height:number
     break-if done?:boolean
     {
@@ -311,10 +309,19 @@ recipe render [
       column:number <- add column:number, 1:literal
       loop
     }
+    # clear one more line just in case we just backspaced out of it
     row:number <- add row:number, 1:literal
-    column:number <- copy 0:literal
+    column:number <- copy left:number
+    done?:boolean <- greater-or-equal row:number, screen-height:number
+    break-if done?:boolean
     move-cursor screen:address, row:number, column:number
-    loop
+    {
+      line-done?:boolean <- greater-or-equal column:number, right:number
+      break-if line-done?:boolean
+      print-character screen:address, 32:literal/space
+      column:number <- add column:number, 1:literal
+      loop
+    }
   }
   # update cursor
   {
@@ -1418,6 +1425,27 @@ scenario editors-chain-to-cover-multiple-columns [
   ]
 ]
 
+scenario multiple-editors-cover-only-their-own-areas [
+  assume-screen 10:literal/width, 5:literal/height
+  draw-vertical screen:address, 5:literal/divider, 0:literal/top, 5:literal/height
+  run [
+    # initialize an editor covering left half of screen
+    1:address:array:character <- new [abc]
+    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
+    3:address:array:character <- new [def]
+    # chain new editor to it, covering the right half of the screen
+    4:address:address:editor-data <- get-address 2:address:editor-data/deref, next-editor:offset
+    4:address:address:editor-data/deref <- new-editor 3:address:array:character, screen:address, 0:literal/top, 6:literal/left, 10:literal/right
+  ]
+  screen-should-contain [
+    .abc  │def .
+    .     │    .
+    .     │    .
+    .     │    .
+    .     │    .
+  ]
+]
+
 scenario editor-in-focus-keeps-cursor [
   assume-screen 10:literal/width, 5:literal/height
   # initialize an editor covering left half of screen