diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-19 22:51:43 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-19 22:51:43 -0700 |
commit | e43ff485e6fcff8cbf004d8db00c489a60437094 (patch) | |
tree | c5ca068306e2db95905c930c75be6a486756f64d /apps | |
parent | 1436f0298f4c6b9a141a4f23fb89f5c00e98175d (diff) | |
download | mu-e43ff485e6fcff8cbf004d8db00c489a60437094.tar.gz |
6813 - tile: right-cursor is now easy
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tile/environment.mu | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index d589464c..275b87df 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -49,7 +49,7 @@ $process:body: { var cursor-word-ah/edi: (addr handle word) <- get self, cursor-word var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah var cursor-word/ecx: (addr word) <- copy _cursor-word - # if not at start, gap-left + # if not at start, move left within current word var at-start?/eax: boolean <- cursor-at-start? cursor-word compare at-start?, 0 # false { @@ -57,7 +57,7 @@ $process:body: { cursor-left cursor-word break $process:body } - # otherwise, move gap to end of prev word + # otherwise, move to end of prev word var prev-word-ah/esi: (addr handle word) <- get cursor-word, prev var prev-word/eax: (addr word) <- lookup *prev-word-ah { @@ -71,11 +71,26 @@ $process:body: { compare key, 0x435b1b # right-arrow { break-if-!= - # TODO: - # gap-right cursor-word - # or - # cursor-word = cursor-word->next - # gap-to-start cursor-word + var cursor-word-ah/edi: (addr handle word) <- get self, cursor-word + var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah + var cursor-word/ecx: (addr word) <- copy _cursor-word + # if not at end, move right within current word + var at-end?/eax: boolean <- cursor-at-end? cursor-word + compare at-end?, 0 # false + { + break-if-= + cursor-right cursor-word + break $process:body + } + # otherwise, move to start of next word + var next-word-ah/esi: (addr handle word) <- get cursor-word, next + var next-word/eax: (addr word) <- lookup *next-word-ah + { + compare next-word, 0 + break-if-= + copy-object next-word-ah, cursor-word-ah + cursor-to-start next-word + } break $process:body } compare key, 0x20 # space |