From d467b0a5b2ebf4e3bbfb510ca317e6141cce0d06 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 24 Jun 2017 15:48:57 -0700 Subject: 3950 Fix a regression caused by commit 3919. Thanks Juan Crispin Hernandez for running into this. --- sandbox/003-shortcuts.mu | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'sandbox') 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 -- cgit 1.4.1-2-gfad0