about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--edit/004-programming-environment.mu25
-rw-r--r--sandbox/004-programming-environment.mu29
2 files changed, 52 insertions, 2 deletions
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu
index 7255c7c5..afb176a7 100644
--- a/edit/004-programming-environment.mu
+++ b/edit/004-programming-environment.mu
@@ -513,3 +513,28 @@ def draw-vertical screen:&:screen, col:num, y:num, bottom:num -> screen:&:screen
     loop
   }
 ]
+
+scenario backspace-over-text [
+  local-scope
+  trace-until 100/app  # trace too long
+  assume-screen 50/width, 15/height
+  # recipes.mu is empty
+  assume-resources [
+  ]
+  # sandbox editor contains an instruction without storing outputs
+  env:&:environment <- new-programming-environment resources, screen, []
+  # run the code in the editors
+  assume-console [
+    type [a]
+    press backspace
+  ]
+  run [
+    event-loop screen, console, env, resources
+    10:num/raw <- get *screen, cursor-row:offset
+    11:num/raw <- get *screen, cursor-column:offset
+  ]
+  memory-should-contain [
+    10 <- 1
+    11 <- 0
+  ]
+]
diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu
index 656a3f97..af64076d 100644
--- a/sandbox/004-programming-environment.mu
+++ b/sandbox/004-programming-environment.mu
@@ -90,9 +90,9 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources:
         render-all-on-no-more-events? <- copy 0/false
         screen <- render-all screen, env, render
       }
-      +finish-event
-      screen <- update-cursor screen, current-sandbox, env
     }
+    +finish-event
+    screen <- update-cursor screen, current-sandbox, env
     loop
   }
 ]
@@ -241,3 +241,28 @@ def update-cursor screen:&:screen, current-sandbox:&:editor, env:&:environment -
   cursor-column:num <- get *current-sandbox, cursor-column:offset
   screen <- move-cursor screen, cursor-row, cursor-column
 ]
+
+scenario backspace-over-text [
+  local-scope
+  trace-until 100/app  # trace too long
+  assume-screen 50/width, 15/height
+  # recipes.mu is empty
+  assume-resources [
+  ]
+  # sandbox editor contains an instruction without storing outputs
+  env:&:environment <- new-programming-environment resources, screen, []
+  # run the code in the editors
+  assume-console [
+    type [a]
+    press backspace
+  ]
+  run [
+    event-loop screen, console, env, resources
+    10:num/raw <- get *screen, cursor-row:offset
+    11:num/raw <- get *screen, cursor-column:offset
+  ]
+  memory-should-contain [
+    10 <- 1
+    11 <- 0
+  ]
+]