diff options
| author | Andrés Cuervo <andrescuervor@gmail.com> | 2024-02-02 16:28:28 +0000 |
|---|---|---|
| committer | Andrés Cuervo <andrescuervor@gmail.com> | 2024-02-02 16:28:28 +0000 |
| commit | ceacf079bbc1580d1080c5acf026e77194362f62 (patch) | |
| tree | adc8cd5d35365a46c55d21c53c164e1c8e92d159 /virtual-programs | |
| parent | Revert "Fix key press on restart" (diff) | |
| download | folk-ceacf079bbc1580d1080c5acf026e77194362f62.tar.gz folk-ceacf079bbc1580d1080c5acf026e77194362f62.zip | |
Correctly filter keys pressed after editor start time
Prevent keys from being processed before the editor start time.
Diffstat (limited to 'virtual-programs')
| -rw-r--r-- | virtual-programs/editor.folk | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk index 3dd03044..268fbcca 100644 --- a/virtual-programs/editor.folk +++ b/virtual-programs/editor.folk @@ -8,7 +8,10 @@ When /page/ is a keyboard with path /anything/ { Claim $page is an editor } -When /page/ is a keyboard with path /kbPath/ & /page/ is an editor & /page/ has region /r/ { +When /page/ is a keyboard with path /kbPath/ &\ + /page/ is an editor &\ + /page/ has region /r/ &\ + the clock time is /t/ { set id "$page$kbPath" Claim $id has region [region move $r up 210%] When /nobody/ claims $id has program code /c/ { @@ -17,6 +20,19 @@ When /page/ is a keyboard with path /kbPath/ & /page/ is an editor & /page/ has Claim $id has editor code $baseCode } } + + When /nobody/ claims $id has start time /startTime/ { + Commit "time$kbPath" { + Claim $id has start time $t + } + } +} + +When /page/ is a keyboard with path /kbPath/ { + On unmatch { + puts "unmatching" + Commit "time$kbPath" {} + } } proc updateCursor {oldCursor updates} { @@ -180,8 +196,10 @@ When /page/ is a keyboard with path /kbPath/ & /page/ is an editor { Every time keyboard $kbPath claims key /currentCharacter/ is /keyState/ with modifiers /modifier/ timestamp /timestamp/ &\ the $kbPath cursor is /cursor/ &\ $id has program code /code/ &\ - $id has editor code /editorCode/ { - if {$keyState == "down" || $keyState == "repeat"} { + $id has editor code /editorCode/ &\ + $id has start time /startTime/ { + if {($keyState == "down" || $keyState == "repeat") & $timestamp > ($startTime * 1000) } { + puts "$currentCharacter [expr {$timestamp > ($startTime * 1000)}]" Commit "cursor$kbPath" { switch $currentCharacter { UP { |
