diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-10 17:51:57 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-10 17:51:57 -0800 |
commit | 5b6710871382930f7242e293057d8685b12cd77f (patch) | |
tree | bdc1745625357ed4af1a25eed0005104df32ccdd | |
parent | 49b6493a99cdcf66b2c9da42318238e26c652c81 (diff) | |
download | mu-5b6710871382930f7242e293057d8685b12cd77f.tar.gz |
731
-rw-r--r-- | mu.arc | 33 | ||||
-rw-r--r-- | trace.mu | 8 |
2 files changed, 37 insertions, 4 deletions
diff --git a/mu.arc b/mu.arc index b6a3cfd4..9286cede 100644 --- a/mu.arc +++ b/mu.arc @@ -2582,6 +2582,39 @@ (cursor-on-host-to-next-line) ) +(init-fn cursor-down + (default-space:space-address <- new space:literal 30:literal) + (x:terminal-address <- next-input) + (height:integer-address <- get-address x:terminal-address/deref num-rows:offset) + { begin + (break-unless x:terminal-address) + (row:integer-address <- get-address x:terminal-address/deref cursor-row:offset) + { begin + (bottom?:boolean <- lesser-or-equal row:integer-address/deref height:integer-address/deref) + (break-if bottom?:boolean) + (row:integer-address/deref <- add row:integer-address/deref 1:literal) + } + (reply) + } + (cursor-down-on-host) +) + +(init-fn cursor-up + (default-space:space-address <- new space:literal 30:literal) + (x:terminal-address <- next-input) + { begin + (break-unless x:terminal-address) + (row:integer-address <- get-address x:terminal-address/deref cursor-row:offset) + { begin + (top?:boolean <- lesser-or-equal row:integer-address/deref 0:literal) + (break-if top?:boolean) + (row:integer-address/deref <- subtract row:integer-address/deref 1:literal) + } + (reply) + } + (cursor-up-on-host) +) + (init-fn print-character (default-space:space-address <- new space:literal 30:literal) (x:terminal-address <- next-input) diff --git a/trace.mu b/trace.mu index 06674020..f5287930 100644 --- a/trace.mu +++ b/trace.mu @@ -248,7 +248,7 @@ schedule: done with routine") (at-top?:boolean <- lesser-or-equal cursor-row:integer 0:literal) (break-if at-top?:boolean) (cursor-row:integer <- subtract cursor-row:integer 1:literal) - (cursor-up-on-host) + (cursor-up nil:literal/keyboard) (jump next-key:offset) ; loop } { begin @@ -257,7 +257,7 @@ schedule: done with routine") (at-bottom?:boolean <- greater-or-equal cursor-row:integer len:integer) (break-if at-bottom?:boolean) (cursor-row:integer <- add cursor-row:integer 1:literal) - (cursor-down-on-host) + (cursor-down nil:literal/keyboard) (jump next-key:offset) ; loop } ; enter: expand current row @@ -269,14 +269,14 @@ schedule: done with routine") (jump next-key:offset) ; loop } ; debugging: print cursor-row - ($print cursor-row:integer) +;? ($print cursor-row:integer) ;? 1 (loop) } ; move cursor to bottom before exiting { begin (at-bottom?:boolean <- greater-or-equal cursor-row:integer len:integer) (break-if at-bottom?:boolean) - (cursor-down-on-host) + (cursor-down nil:literal/terminal) (cursor-row:integer <- add cursor-row:integer 1:literal) (loop) } |