summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorAndrés Cuervo <andrescuervor@gmail.com>2023-10-18 20:58:39 +0000
committerAndrés Cuervo <andrescuervor@gmail.com>2023-10-18 20:58:39 +0000
commitff5492089a0e4299123c63ed814afb0fcf7e26cf (patch)
treeda10ecc17994e3cba36f7bdd3dbb29b3475ac8db /virtual-programs
parentMerge branch 'main' into ac/editor (diff)
downloadfolk-ff5492089a0e4299123c63ed814afb0fcf7e26cf.tar.gz
folk-ff5492089a0e4299123c63ed814afb0fcf7e26cf.zip
Fix cursor movement on newline & backspace at x=0
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/editor.folk9
1 files changed, 6 insertions, 3 deletions
diff --git a/virtual-programs/editor.folk b/virtual-programs/editor.folk
index 52261f11..cf7cec30 100644
--- a/virtual-programs/editor.folk
+++ b/virtual-programs/editor.folk
@@ -80,7 +80,7 @@ proc insertNewline {code cursor} {
proc insertCursor {code cursor count} {
if {$count % 2 == 0} {
- return [swapCharacter $code "X" $cursor]
+ return [swapCharacter $code "_" $cursor]
} else {
return $code
}
@@ -212,8 +212,9 @@ Every time keyboard claims key /currentCharacter/ is down with modifiers /modifi
if {[x $cursor] == 0} {
set newCursor [updateCursor $cursor {y -1}]
set previousLineLength [getCurrentLineLength $code $newCursor]
- set newCursor [list [expr {$previousLineLength - 1}] [y $newCursor]]
+ set newCursor [list $previousLineLength [y $newCursor]]
Claim the cursor is $newCursor
+ # Delete the old line???
} else {
Claim the cursor is [updateCursor $cursor {x -1}]
}
@@ -224,7 +225,9 @@ Every time keyboard claims key /currentCharacter/ is down with modifiers /modifi
Commit code { Claim $id has program code [insertCharacter $code " " $cursor] }
}
ENTER {
- Claim the cursor is [updateCursor $cursor {x [expr {-1 * [x $cursor]}] y 1}]
+ # GOAL: Move cursor to beginning of next line
+ set updatedCursor [updateCursor $cursor {y 1}]
+ Claim the cursor is [list 0 [lindex $updatedCursor 1]]
Commit code { Claim $id has program code [insertNewline $code $cursor] }
}
LEFTSHIFT -