diff options
-rw-r--r-- | apps/tile/data.mu | 2 | ||||
-rw-r--r-- | apps/tile/environment.mu | 27 | ||||
-rw-r--r-- | apps/tile/main.mu | 58 |
3 files changed, 34 insertions, 53 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu index d864c640..adf9ac6a 100644 --- a/apps/tile/data.mu +++ b/apps/tile/data.mu @@ -429,6 +429,8 @@ fn decrement-final-element list: (addr handle call-path-element) { var final-ah/eax: (addr handle call-path-element) <- copy list var final/eax: (addr call-path-element) <- lookup *final-ah var val/eax: (addr int) <- get final, index-in-body + compare *val, 0 + break-if-= decrement *val } diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 193fbc97..2dc57240 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -218,6 +218,7 @@ $process:body: { compare key, 0x10 # 16 = ctrl-p { break-if-!= +#? print-string 0, "AA\n" # jump to previous word at same level var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev var prev-word/eax: (addr word) <- lookup *prev-word-ah @@ -228,6 +229,32 @@ $process:body: { cursor-to-end prev-word var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path decrement-final-element cursor-call-path + break $process:body + } + # if previous word doesn't exist, try to bump up one level +#? print-string 0, "BB\n" + { + var next-word-ah/edx: (addr handle word) <- get cursor-word, next + var next-word/eax: (addr word) <- lookup *next-word-ah + compare next-word, 0 + break-if-= +#? print-string 0, "CC\n" + var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah + compare caller-cursor-element, 0 + break-if-= + # check if previous word exists in caller +#? print-string 0, "DD\n" + var caller-index/eax: (addr int) <- get caller-cursor-element, index-in-body + compare *caller-index, 0 + break-if-<= + # if so jump to it +#? print-string 0, "EE\n" + copy-object caller-cursor-element-ah, cursor-call-path-ah + decrement-final-element cursor-call-path-ah + break $process:body } } # if cursor is within a call, disable editing hotkeys below diff --git a/apps/tile/main.mu b/apps/tile/main.mu index 2336b37b..0a2d6339 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -91,60 +91,12 @@ fn test { process env, g g <- copy 0x445b1b # left-arrow process env, g - { - print-string 0, "== before enter\n" - var functions/ecx: (addr handle function) <- get env, functions - var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes - var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path - var foo/ecx: (addr call-path-element) <- copy _foo - var bar/eax: (addr int) <- get foo, index-in-body - print-int32-hex 0, *bar - print-string 0, "\n" - cursor-call-path <- get foo, next - var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path - var foo/ecx: (addr call-path-element) <- copy _foo - compare foo, 0 - break-if-= - var bar/eax: (addr int) <- get foo, index-in-body - print-int32-hex 0, *bar - print-string 0, "\n" - } - g <- copy 0xa # <enter> + g <- copy 0x10 # <ctrl-p> + process env, g + g <- copy 0x10 # <ctrl-p> + process env, g + g <- copy 0x10 # <ctrl-p> process env, g - { - print-string 0, "== after enter\n" - var functions/ecx: (addr handle function) <- get env, functions - var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes - var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path - var foo/ecx: (addr call-path-element) <- copy _foo - var bar/eax: (addr int) <- get foo, index-in-body - print-int32-hex 0, *bar - print-string 0, "\n" - cursor-call-path <- get foo, next - var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path - var foo/ecx: (addr call-path-element) <- copy _foo - compare foo, 0 - break-if-= - var bar/eax: (addr int) <- get foo, index-in-body - print-int32-hex 0, *bar - print-string 0, "\n" - cursor-call-path <- get foo, next - var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path - var foo/ecx: (addr call-path-element) <- copy _foo - compare foo, 0 - break-if-= - var bar/eax: (addr int) <- get foo, index-in-body - print-int32-hex 0, *bar - print-string 0, "\n" - } - print-string 0, "== render\n" - render env } fn repl { |