about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-09-10 13:25:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-09-10 13:25:48 -0700
commit42b3a2f820e92e7fefab54321f62aa9edf75bd81 (patch)
tree7285899a5f0f803ab7cbb702b9252a527b051164
parenta17ffca8c1487008ec417d3d75309f541df7268e (diff)
downloadmu-42b3a2f820e92e7fefab54321f62aa9edf75bd81.tar.gz
2179 - undo bugfix
-rw-r--r--edit/003-shortcuts.mu2
-rw-r--r--edit/011-editor-undo.mu21
2 files changed, 22 insertions, 1 deletions
diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu
index 879e2826..fe6156a1 100644
--- a/edit/003-shortcuts.mu
+++ b/edit/003-shortcuts.mu
@@ -1558,7 +1558,7 @@ recipe delete-to-start-of-line [
   result:address:duplex-list <- next-duplex start
   remove-duplex-between start, end
   # adjust cursor
-  *before-cursor <- prev-duplex end
+  *before-cursor <- copy start
   left:number <- get *editor, left:offset
   cursor-column:address:number <- get-address *editor, cursor-column:offset
   *cursor-column <- copy left
diff --git a/edit/011-editor-undo.mu b/edit/011-editor-undo.mu
index 41450f26..adf85130 100644
--- a/edit/011-editor-undo.mu
+++ b/edit/011-editor-undo.mu
@@ -2051,6 +2051,27 @@ before <delete-to-start-of-line-end> [
   }
 ]
 
+scenario editor-can-undo-and-redo-ctrl-u-2 [
+  # create an editor
+  assume-screen 10/width, 5/height
+  1:address:array:character <- new []
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0/left, 10/right
+  editor-render screen, 2:address:editor-data
+  # insert some text and hit delete and backspace a few times
+  assume-console [
+    type [abc]
+    press ctrl-u
+    press ctrl-z
+  ]
+  editor-event-loop screen:address, console:address, 2:address:editor-data
+  screen-should-contain [
+    .          .
+    .abc       .
+    .┈┈┈┈┈┈┈┈┈┈.
+    .          .
+  ]
+]
+
 # todo:
 # operations for recipe side and each sandbox-data
 # undo delete sandbox as a separate primitive on the status bar