summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorZach Potter <zspotting@gmail.com>2023-08-25 05:33:57 +0000
committerZach Potter <zspotting@gmail.com>2023-08-25 05:33:57 +0000
commit7590f4424917e34c01caac722bd97ac28587bcbc (patch)
tree1c23fe9cf10338ec365cc9f15e64609873e613a8 /virtual-programs
parentmultiple terminal instances (diff)
downloadfolk-7590f4424917e34c01caac722bd97ac28587bcbc.tar.gz
folk-7590f4424917e34c01caac722bd97ac28587bcbc.zip
cleanup and todos
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/terminal.folk27
1 files changed, 14 insertions, 13 deletions
diff --git a/virtual-programs/terminal.folk b/virtual-programs/terminal.folk
index ae13a080..4cbf6339 100644
--- a/virtual-programs/terminal.folk
+++ b/virtual-programs/terminal.folk
@@ -1,28 +1,29 @@
# Terminal
#
-# Claim $this is a terminal
+# Wish $this is a terminal
+# Claim $this has keyboard input
#
source lib/terminal.tcl
-When /anyone/ claims /thing/ is a terminal {
- # First time init, so that we don't get a new instance each time the $thing is detected
- When /nobody/ claims $thing has term /t/ {
- Assert terminal claims $thing has term [Terminal::create]
+When /anyone/ wishes /thing/ is a terminal {
+ # Create a new terminal instance for this $thing only once
+ When /nobody/ claims $thing has terminal instance /term/ {
+ Assert terminal claims $thing has terminal instance [Terminal::create]
}
- When terminal claims $thing has term /term/ {
- # TODO: all terminals share the same keyboard!
- When /anyone/ claims key /key/ is /direction/ with modifiers /modifiers/ {
+ When terminal claims $thing has terminal instance /term/ {
+ When $thing has region /r/ & /node/ has step count /c/ {
+ set display [region move $r up 180px]
+ Wish region $display is labelled [Terminal::read $term]
+ }
+
+ When /anyone/ claims $thing has keyboard input & \
+ /anyone/ claims key /key/ is /direction/ with modifiers /modifiers/ {
if {$direction != "up"} {
set ctrlPressed [expr {"ctrl" in $modifiers}]
Terminal::write $term $key $ctrlPressed
}
}
-
- When $thing has region /r/ & /node/ has step count /c/ {
- set display [region move $r up 180px]
- Wish region $display is labelled [Terminal::read $term]
- }
}
}