about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-02 00:28:44 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-02 00:28:44 -0700
commitc77cc6ccd4f49af17cd99f43510cd2a174b26f9f (patch)
treeddf04b2827167b0a4f5568effdb5e86a686433f2
parent09ef3a783e555e217914653abf7e033aae199c8c (diff)
downloadmu-c77cc6ccd4f49af17cd99f43510cd2a174b26f9f.tar.gz
1696 - more cursor-wrap purging
-rw-r--r--edit.mu54
1 files changed, 23 insertions, 31 deletions
diff --git a/edit.mu b/edit.mu
index 9b595fc1..245762b0 100644
--- a/edit.mu
+++ b/edit.mu
@@ -583,13 +583,10 @@ recipe handle-event [
       wrap-column:number <- subtract right:number, 1:literal
       at-wrap?:boolean <- equal cursor-column:address:number/deref, wrap-column:number
       break-unless at-wrap?:boolean
-      # and if character after next isn't newline
-#?       $print [aaa] #? 1
+      # and if next character isn't newline
       new-cursor:address:duplex-list <- next-duplex old-cursor:address:duplex-list
       break-unless new-cursor:address:duplex-list
-      next:address:duplex-list <- next-duplex new-cursor:address:duplex-list
-      break-unless next:address:duplex-list
-      next-character:character <- get next:address:duplex-list/deref, value:offset
+      next-character:character <- get new-cursor:address:duplex-list/deref, value:offset
       newline?:boolean <- equal next-character:character, 10:literal/newline
       break-if newline?:boolean
       cursor-row:address:number/deref <- add cursor-row:address:number/deref, 1:literal
@@ -1298,10 +1295,12 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow [
 
 scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [
   assume-screen 10:literal/width, 5:literal/height
-  1:address:array:character <- new [abcdef]
-  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 1:literal/left, 6:literal/right
+  # line just barely wrapping
+  1:address:array:character <- new [abcde]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
+  # position cursor at last character before wrap and hit right-arrow
   assume-console [
-    left-click 0, 4
+    left-click 0, 3
     press 65514  # right arrow
   ]
   run [
@@ -1309,24 +1308,13 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
   ]
-  screen-should-contain [
-    . abcd↩    .
-    . ef       .
-    .          .
-  ]
   memory-should-contain [
     3 <- 1
-    4 <- 1
+    4 <- 0
   ]
-]
-
-scenario editor-does-not-wrap-cursor-when-line-does-not-wrap [
-  assume-screen 10:literal/width, 5:literal/height
-  1:address:array:character <- new [abcde]
-  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
+  # now hit right arrow again
   assume-console [
-    left-click 0, 3  # one before right, in the last line
-    press 65514  # right arrow
+    press 65514
   ]
   run [
     event-loop screen:address, console:address, 2:address:editor-data
@@ -1334,18 +1322,17 @@ scenario editor-does-not-wrap-cursor-when-line-does-not-wrap [
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
   ]
   memory-should-contain [
-    3 <- 0
-    4 <- 4
+    3 <- 1
+    4 <- 1
   ]
 ]
 
-scenario editor-does-not-wrap-cursor-when-line-does-not-wrap-2 [
+scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-3 [
   assume-screen 10:literal/width, 5:literal/height
-  1:address:array:character <- new [abcde
-f]
-  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
+  1:address:array:character <- new [abcdef]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 1:literal/left, 6:literal/right
   assume-console [
-    left-click 0, 3  # one before right, not the last line
+    left-click 0, 4
     press 65514  # right arrow
   ]
   run [
@@ -1353,9 +1340,14 @@ f]
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
   ]
+  screen-should-contain [
+    . abcd↩    .
+    . ef       .
+    .          .
+  ]
   memory-should-contain [
-    3 <- 0
-    4 <- 4
+    3 <- 1
+    4 <- 1
   ]
 ]