about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
Diffstat (limited to 'edit')
-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