about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-27 00:27:01 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-27 00:28:38 -0800
commit8328a3261d2f9090edabfd1f40b74a61588f76e0 (patch)
tree9eac07db6cfab4a3f5252adf41e82fb0db20fd6b
parentd54c3dda5a32fe22989d66e266864132489a08b8 (diff)
downloadmu-8328a3261d2f9090edabfd1f40b74a61588f76e0.tar.gz
848
-rw-r--r--trace.arc.t13
-rw-r--r--trace.mu13
2 files changed, 14 insertions, 12 deletions
diff --git a/trace.arc.t b/trace.arc.t
index 9278fcf9..a8d23792 100644
--- a/trace.arc.t
+++ b/trace.arc.t
@@ -672,20 +672,19 @@ run: main 7: n")
 ; now page-up
 (run-code main8
   (default-space:space-address <- new space:literal 30:literal/capacity)
-  (s:string-address <- new "jJ")
+  (s:string-address <- new "K")
   (k:keyboard-address <- init-keyboard s:string-address)
   (process-key 3:space-address/raw/browser-state k:keyboard-address 2:terminal-address/raw)
-  (process-key 3:space-address/raw/browser-state k:keyboard-address 2:terminal-address/raw)
   )
-; page-down behaves the same regardless of where the cursor was
+; precisely undoes previous page-down
 (when (~screen-contains memory*.4 17
-         (+ "+ main/ 6 : m    "
-            "+ main/ 7 : n    "
+         (+ "+ main/ 3 : j    "
+            "+ main/ 4 : k    "
+            "+ main/ 5 : l    "
             "                 "))
-  (prn "F - 'page-down' skips to same place regardless of cursor position"))
+  (prn "F - 'page-up' on partial page behaves as if page was full"))
 
 ; todo
-;   pgup/pgdn to navigate pages (minimize up/down responsibilities for performance)
 ;   expanded trace straddles page boundary
 ;   what if entire page is within an expanded trace?
 
diff --git a/trace.mu b/trace.mu
index 466e5ec9..603bbc00 100644
--- a/trace.mu
+++ b/trace.mu
@@ -489,8 +489,10 @@
     ; move cursor to top of screen
     (to-top 0:space-address/browser-state screen:terminal-address)
     ; start drawing from previous page
-    (new-page-start:integer <- subtract first-index-on-page:integer/space:1 screen-height:integer/space:1)
-    (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address new-page-start:integer)
+    (first-index-on-page:integer/space:1 <- subtract first-index-on-page:integer/space:1 screen-height:integer/space:1)
+    ; don't need to check for less than zero because page-up/page-down won't
+    ; currently allow it
+    (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address first-index-on-page:integer/space:1)
   }
   { begin
     (page-down?:boolean <- equal c:character ((page-up literal)))
@@ -499,13 +501,14 @@
     (break-unless page-down?:boolean)
     ; if we're not past end of trace
     (len:integer <- length traces:instruction-trace-address-array-address/space:1/deref)
-    (new-page-start:integer <- add last-index-on-page:integer/space:1 1:literal)
-    (last-page?:boolean <- greater-or-equal new-page-start:integer len:integer)
+    (next-page-start:integer <- add last-index-on-page:integer/space:1 1:literal)
+    (last-page?:boolean <- greater-or-equal next-page-start:integer len:integer)
     (break-if last-page?:boolean)
     ; move cursor to top of screen
     (to-top 0:space-address/browser-state screen:terminal-address)
     ; start drawing from next page
-    (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address new-page-start:integer)
+    (first-index-on-page:integer/space:1 <- copy next-page-start:integer)
+    (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address first-index-on-page:integer/space:1)
   }
   ; enter: expand/collapse current row
   { begin