summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorAndrés Cuervo <andrescuervor@gmail.com>2024-02-01 23:12:42 +0000
committerAndrés Cuervo <andrescuervor@gmail.com>2024-02-01 23:12:42 +0000
commit80f3e29c4f3fcad460c7d12b8a81f8aa21abd25d (patch)
treef2dc930c9c9b0c6d741f0b0d450b69b0625f63a3 /virtual-programs
parentFix delete when cursor is at (0, 0) (diff)
downloadfolk-80f3e29c4f3fcad460c7d12b8a81f8aa21abd25d.tar.gz
folk-80f3e29c4f3fcad460c7d12b8a81f8aa21abd25d.zip
Fix key press on restart
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/editor.folk19
1 files changed, 16 insertions, 3 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk
index 3dd03044..c1dd30d1 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,15 @@ 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
+ }
+ }
+
+ On unmatch {
+ Commit "time$kbPath" {}
+ }
}
proc updateCursor {oldCursor updates} {
@@ -180,8 +192,9 @@ 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) } {
Commit "cursor$kbPath" {
switch $currentCharacter {
UP {