From c822d1543ea15c43b8bb2e223bc25bf5c78de435 Mon Sep 17 00:00:00 2001 From: d6 Date: Mon, 13 Feb 2023 22:47:59 -0500 Subject: [PATCH] hide cursor after 1 second of no movement --- term.tal | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/term.tal b/term.tal index 4f1abd4..4287428 100644 --- a/term.tal +++ b/term.tal @@ -104,13 +104,14 @@ @lastmouse-x $2 ( last mouse x ) @lastmouse-y $2 ( last mouse y ) @lastmouse-st $1 ( last mouse press ) - @is-lit $1 - @is-lit-flip $1 - @lit-click-x $2 - @lit-click-y $2 - @lit-drag-x $2 - @lit-drag-y $2 - @flash $1 + @is-lit $1 ( are we selecting an area? ) + @is-lit-flip $1 ( is the selection flipped? i.e. drawing left/up ) + @lit-click-x $2 ( x coord of starting selection click ) + @lit-click-y $2 ( y coord of starting selection click ) + @lit-drag-x $2 ( x coord of selection drag ) + @lit-drag-y $2 ( y coord of selection drag ) + @flash $1 ( visual bell flash timer ) + @pointer-ttl $1 ( visible cursor timer ) ( terminal settings ) @irm $1 ( 01: insert and move right, 00: replace and overwrite ) @@ -253,6 +254,10 @@ POP2 POP2r JMP2r ( ) @redraw ( -> BRK ) + .pointer-ttl LDZ #00 EQU ?&pointer-ok ( ) + .pointer-ttl LDZk INC DUP ROT STZ ?&pointer-ok + #01 .dirty STZ ( redraw without pointer ) + &pointer-ok .dirty LDZ #00 EQU ?&done LIT2r =cells ( [addr*] ) .rows LDZ2 #0000 DUP2 #0008 ( border ) ADD2 .Screen/y DEO2 @@ -495,9 +500,11 @@ @draw-pointer ( -> ) .lastmouse-x LDZ2 .lastmouse-y LDZ2 ( x* y* ) - #01e0 ;cp437 ADD2 !draw-at ( ) + .pointer-ttl LDZ ?&visible #0000 !&finally + &visible #01e0 &finally ;cp437 ADD2 !draw-at @on-move ( -> ) + #c4 .pointer-ttl STZ ( pointer visible for ~1 second ) .Mouse/x DEI2 .lastmouse-x LDZ2 NEQ2 ?&redraw ( ) .Mouse/y DEI2 .lastmouse-y LDZ2 NEQ2 ?&redraw ( ) JMP2r ( )