about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-06-24 15:48:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-06-24 15:48:57 -0700
commitd467b0a5b2ebf4e3bbfb510ca317e6141cce0d06 (patch)
treee92777b1263c380dc4f93e1472db43cbb845ce7d /sandbox
parentc4cff3b3555e509ecbefa3d2298a54758f687bf5 (diff)
downloadmu-d467b0a5b2ebf4e3bbfb510ca317e6141cce0d06.tar.gz
3950
Fix a regression caused by commit 3919.

Thanks Juan Crispin Hernandez for running into this.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/003-shortcuts.mu45
1 files changed, 43 insertions, 2 deletions
diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu
index 1b5f8a46..6fdd70b8 100644
--- a/sandbox/003-shortcuts.mu
+++ b/sandbox/003-shortcuts.mu
@@ -1011,7 +1011,8 @@ def move-to-previous-line editor:&:editor -> editor:&:editor [
     curr:&:duplex-list:char <- copy before-cursor
     old:&:duplex-list:char <- copy curr
     {
-      break-unless cursor-column
+      at-left?:bool <- equal cursor-column, left
+      break-if at-left?
       curr <- before-previous-screen-line curr, editor
       no-motion?:bool <- equal curr, old
       return-if no-motion?
@@ -1121,7 +1122,7 @@ def]
   ]
 ]
 
-scenario editor-moves-to-previous-line-from-left-margin [
+scenario editor-moves-to-previous-line-from-zero-margin [
   local-scope
   assume-screen 10/width, 5/height
   # start out with three lines
@@ -1161,6 +1162,46 @@ ghi]
   ]
 ]
 
+scenario editor-moves-to-previous-line-from-left-margin [
+  local-scope
+  assume-screen 10/width, 5/height
+  # start out with three lines
+  s:text <- new [abc
+def
+ghi]
+  e:&:editor <- new-editor s, 1/left, 10/right
+  editor-render screen, e
+  $clear-trace
+  # click on the third line and hit up-arrow, so you end up just after a newline
+  assume-console [
+    left-click 3, 1
+    press up-arrow
+  ]
+  run [
+    editor-event-loop screen, console, e
+    3:num/raw <- get *e, cursor-row:offset
+    4:num/raw <- get *e, cursor-column:offset
+  ]
+  memory-should-contain [
+    3 <- 2
+    4 <- 1
+  ]
+  check-trace-count-for-label 0, [print-character]
+  assume-console [
+    type [0]
+  ]
+  run [
+    editor-event-loop screen, console, e
+  ]
+  screen-should-contain [
+    .          .
+    . abc      .
+    . 0def     .
+    . ghi      .
+    . ┈┈┈┈┈┈┈┈┈.
+  ]
+]
+
 scenario editor-moves-to-top-line-in-presence-of-wrapped-line [
   local-scope
   assume-screen 10/width, 5/height