about summary refs log tree commit diff stats
path: root/edit.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-24 13:51:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-24 13:51:12 -0700
commit5af1e35808fd09f8cea1969ef937bd42299d30b2 (patch)
treec6eb4587427b5134ed5c87a58f0ee6cc2d2819fd /edit.mu
parent086acf397feb149a3e466300904d31d5f2684269 (diff)
downloadmu-5af1e35808fd09f8cea1969ef937bd42299d30b2.tar.gz
2065 - arrow bugfix
Diffstat (limited to 'edit.mu')
-rw-r--r--edit.mu40
1 files changed, 37 insertions, 3 deletions
diff --git a/edit.mu b/edit.mu
index 5a3dadd4..4eaca4cb 100644
--- a/edit.mu
+++ b/edit.mu
@@ -2273,9 +2273,7 @@ after +handle-special-key [
         break-unless curr
         currc:character <- get *curr, value:offset
         at-newline?:boolean <- equal currc, 10/newline
-        not-at-start?:boolean <- greater-than *cursor-column, left
-        line-done?:boolean <- and at-newline?, not-at-start?
-        break-if line-done?
+        break-if at-newline?
         #
         *before-cursor <- copy curr
         *cursor-column <- add *cursor-column, 1
@@ -2328,6 +2326,42 @@ def]
   ]
 ]
 
+scenario editor-adjusts-column-at-empty-line [
+  assume-screen 10/width, 5/height
+  1:address:array:character <- new [
+def]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0/left, 10/right
+  editor-render screen, 2:address:editor-data
+  $clear-trace
+  assume-console [
+    left-click 2, 3
+    press 65517  # up arrow
+  ]
+  run [
+    editor-event-loop screen:address, console:address, 2:address:editor-data
+    3:number <- get *2:address:editor-data, cursor-row:offset
+    4:number <- get *2:address:editor-data, cursor-column:offset
+  ]
+  memory-should-contain [
+    3 <- 1
+    4 <- 0
+  ]
+  check-trace-count-for-label 0, [print-character]
+  assume-console [
+    type [0]
+  ]
+  run [
+    editor-event-loop screen:address, console:address, 2:address:editor-data
+  ]
+  screen-should-contain [
+    .          .
+    .0         .
+    .def       .
+    .┈┈┈┈┈┈┈┈┈┈.
+    .          .
+  ]
+]
+
 # down arrow
 
 scenario editor-moves-to-next-line-with-down-arrow [