diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-01 22:49:31 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-01 22:49:31 -0700 |
commit | 4230946e6a48a94e40b117d24397f2787f950f45 (patch) | |
tree | e45719a73c85558f798c2f9d3f967c060426b5dd /apps/tile | |
parent | 8e607b128c85dc7f6e17fd40e0a10a6d5bdb12ac (diff) | |
download | mu-4230946e6a48a94e40b117d24397f2787f950f45.tar.gz |
6925 - tile: don't try to print escape sequences
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/environment.mu | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 2fa81894..6f648ebb 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -416,5 +416,44 @@ fn clear-canvas _env: (addr environment) { } fn real-grapheme? g: grapheme -> result/eax: boolean { +$real-grapheme?:body: { + # if g == newline return true + compare g, 0xa + { + break-if-!= + result <- copy 1 # true + break $real-grapheme?:body + } + # if g == tab return true + compare g, 9 + { + break-if-!= + result <- copy 1 # true + break $real-grapheme?:body + } + # if g < 32 return false + compare g, 0x20 + { + break-if->= + result <- copy 0 # false + break $real-grapheme?:body + } + # if g <= 255 return true + compare g, 0xff + { + break-if-> + result <- copy 1 # true + break $real-grapheme?:body + } + # if (g&0xff == Esc) it's an escape sequence + and-with g, 0xff + compare g, 0x1b # Esc + { + break-if-!= + result <- copy 0 # false + break $real-grapheme?:body + } + # otherwise return true result <- copy 1 # true } +} |