From 9cbb6dce5400aa2218daa6408f544d99fde6c614 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 11 Oct 2020 00:23:35 -0700 Subject: 7002 - tile: next-word --- apps/tile/environment.mu | 34 ++++++++++++++++++++++++++++++++++ apps/tile/main.mu | 6 +++++- 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 51adfdd8..643cd13f 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -202,6 +202,11 @@ $process:body: { compare curr-word-is-expanded?, 0 # false break-if-= push-to-call-path-element cursor-call-path, 0 + # position cursor at left + var functions/eax: (addr handle function) <- get self, functions + get-cursor-word sandbox, functions, cursor-word-ah + var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + cursor-to-start cursor-word #? print-string 0, "d\n" break $process:body } @@ -252,6 +257,35 @@ $process:body: { break $process:body } } + compare key, 0xe # 14 = ctrl-n + $process:next-word: { + break-if-!= + print-string 0, "AA\n" + # jump to previous word at same level + 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, "BB\n" + copy-object next-word-ah, cursor-word-ah + cursor-to-end next-word + var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + increment-final-element cursor-call-path + break $process:body + } + # if next word doesn't exist, try to bump up one level + 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-= + print-string 0, "DD\n" + copy-object caller-cursor-element-ah, cursor-call-path-ah + break $process:body + } # if cursor is within a call, disable editing hotkeys below var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah diff --git a/apps/tile/main.mu b/apps/tile/main.mu index 0a2d6339..157adc48 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -95,7 +95,11 @@ fn test { process env, g g <- copy 0x10 # process env, g - g <- copy 0x10 # + g <- copy 0xe # + process env, g + g <- copy 0xe # + process env, g + g <- copy 0xe # process env, g } -- cgit 1.4.1-2-gfad0