diff options
| author | Andrés Cuervo <andrescuervor@gmail.com> | 2023-12-27 21:43:37 +0000 |
|---|---|---|
| committer | Andrés Cuervo <andrescuervor@gmail.com> | 2023-12-27 21:43:37 +0000 |
| commit | 2e69b09b1e86a5a8fab01e0071a2ae311946ea55 (patch) | |
| tree | d8a537d46fdbcea952d5f01a04937f5ed7b6a760 /virtual-programs | |
| parent | Make direction keys continous (diff) | |
| download | folk-2e69b09b1e86a5a8fab01e0071a2ae311946ea55.tar.gz folk-2e69b09b1e86a5a8fab01e0071a2ae311946ea55.zip | |
Fix cursor persistence to unmatching & LEFT at origin
Diffstat (limited to 'virtual-programs')
| -rw-r--r-- | virtual-programs/editor.folk | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk index 785d442e..f378ec9b 100644 --- a/virtual-programs/editor.folk +++ b/virtual-programs/editor.folk @@ -28,7 +28,12 @@ proc x {vector} { lindex $vector 0 } proc y {vector} { lindex $vector 1 } When /page/ is a keyboard with path /kbPath/ & /page/ is an editor { - Commit "cursor$kbPath" { Claim the $kbPath cursor is [list 0 0]} + set id "$page$kbPath" + When /nobody/ claims $id has program code /c/ { + Commit "cursor$kbPath" { + Claim the $kbPath cursor is [list 0 0] + } + } } proc insertCharacter {code newCharacter cursor} { @@ -167,7 +172,7 @@ When /page/ is a keyboard with path /kbPath/ & /page/ is an editor { set id "$page$kbPath" Every time keyboard $kbPath claims key /currentCharacter/ is /keyState/ with modifiers /modifier/ & the $kbPath cursor is /cursor/ & $id has program code /code/ & $id has editor code /editorCode/ { if {$keyState == "down" || $keyState == "repeat"} { - Commit "cursor$kbPath" { + Commit "cursor$kbPath" { switch $currentCharacter { UP { set updatedCursor [updateCursor $cursor {y -1}] @@ -206,7 +211,9 @@ When /page/ is a keyboard with path /kbPath/ & /page/ is an editor { } } LEFT { - if {[x $cursor] == 0} { + if {[x $cursor] == 0 && [y $cursor] == 0} { + Claim the $kbPath cursor is $cursor + } elseif {[x $cursor] == 0} { set newCursor [updateCursor $cursor {y -1}] set previousLineLength [getCurrentLineLength $editorCode $newCursor] set newCursor [list $previousLineLength [y $newCursor]] |
