about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-19 17:40:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-19 17:40:03 -0700
commit60679557beb29ec77e617d2e2f90d6e58069893d (patch)
treefd686aca6ab78d25e72ceda7720f7c0c3acada41 /sandbox
parentbb2e5e65a42eadba69b3b663c4c118f64d0c4eb7 (diff)
downloadmu-60679557beb29ec77e617d2e2f90d6e58069893d.tar.gz
3866
Yet another bugfix, this time in just the sandbox/ app:
  open sandbox/ with empty lesson/ directory
  type 'a'
  press backspace
  cursor was not moving left

Now fixed.

Turns out the sandbox/ app hadn't been working right since commit 3854.
(Which ironically was a revert but clearly didn't revert enough; the last
truly good commit was 3823, and we're still clawing our way back to the
sunlight.)

The issue in this case was that commit 3853 disabled update-cursor in some
situations when it shouldn't have. To be safe, just always update-cursor
one very event. I should probably reorganize this in edit/ as well, but
it's not necessary for this particular bug.

---

Incidentally, as part of my git bisecting I realized that the bug fixed
in the trace browser as part of commit 3862 was very old:
  press '/'
  press some key
  press ctrl-u to erase
  press some key
  = out of bounds string access
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/004-programming-environment.mu29
1 files changed, 27 insertions, 2 deletions
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
+  ]
+]