diff options
-rw-r--r-- | trace.arc.t | 14 | ||||
-rw-r--r-- | trace.mu | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/trace.arc.t b/trace.arc.t index b138d55a..9278fcf9 100644 --- a/trace.arc.t +++ b/trace.arc.t @@ -669,6 +669,20 @@ run: main 7: n") "+ main/ 7 : n " " ")) (prn "F - 'page-down' skips to same place regardless of cursor position")) +; now page-up +(run-code main8 + (default-space:space-address <- new space:literal 30:literal/capacity) + (s:string-address <- new "jJ") + (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 +(when (~screen-contains memory*.4 17 + (+ "+ main/ 6 : m " + "+ main/ 7 : n " + " ")) + (prn "F - 'page-down' skips to same place regardless of cursor position")) ; todo ; pgup/pgdn to navigate pages (minimize up/down responsibilities for performance) diff --git a/trace.mu b/trace.mu index 3209e941..466e5ec9 100644 --- a/trace.mu +++ b/trace.mu @@ -484,6 +484,13 @@ (K?:boolean <- equal c:character ((#\K literal))) (page-up?:boolean <- or page-up?:boolean K?:boolean) (break-unless page-up?:boolean) + (first-page?:boolean <- lesser-or-equal first-index-on-page:integer/space:1 0:literal) + (break-if first-page?:boolean) + ; 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) } { begin (page-down?:boolean <- equal c:character ((page-up literal))) |