From 7590f4424917e34c01caac722bd97ac28587bcbc Mon Sep 17 00:00:00 2001 From: Zach Potter Date: Thu, 24 Aug 2023 22:33:57 -0700 Subject: cleanup and todos --- virtual-programs/terminal.folk | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'virtual-programs') 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] - } } } -- cgit v1.2.3