diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-08-29 22:16:34 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-08-29 22:20:09 -0700 |
commit | 6e05a8fa27139ddf75a029ad94d44b48a92785b2 (patch) | |
tree | 8d04ae5d057030246305c9dc4b46fb2fe176f643 /513grapheme-stack.mu | |
parent | 4b90a26d71513f3b908b7f7ec651996ddf6460d6 (diff) | |
download | mu-6e05a8fa27139ddf75a029ad94d44b48a92785b2.tar.gz |
fix bad terminology: grapheme -> code point
Unix text-mode terminals transparently support utf-8 these days, and so I treat utf-8 sequences (which I call graphemes in Mu) as fundamental. I then blindly carried over this state of affairs to bare-metal Mu, where it makes no sense. If you don't have a terminal handling font-rendering for you, fonts are most often indexed by code points and not utf-8 sequences.
Diffstat (limited to '513grapheme-stack.mu')
-rw-r--r-- | 513grapheme-stack.mu | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/513grapheme-stack.mu b/513grapheme-stack.mu index 2db873a0..40deb052 100644 --- a/513grapheme-stack.mu +++ b/513grapheme-stack.mu @@ -98,7 +98,12 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel compare i, *top-addr break-if->= { - var g/esi: (addr grapheme) <- index data, i + var c: code-point + { + var g/eax: (addr grapheme) <- index data, i + var tmp/eax: code-point <- to-code-point *g + copy-to c, tmp + } var fg: int { var tmp/eax: int <- copy color @@ -109,7 +114,7 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel break-if-!= copy-to fg, 0xf/highlight } - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color + x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, fg, background-color } i <- increment loop @@ -152,8 +157,13 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: break-if-= compare i, 0 break-if-< - var g/esi: (addr grapheme) <- index data, i - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, background-color, color + var c: code-point + { + var g/eax: (addr grapheme) <- index data, i + var tmp/eax: code-point <- to-code-point *g + copy-to c, tmp + } + x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, background-color, color i <- decrement } # remaining iterations @@ -172,8 +182,13 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: copy-to fg, 0xf/highlight } # - var g/esi: (addr grapheme) <- index data, i - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color + var c: code-point + { + var g/eax: (addr grapheme) <- index data, i + var tmp/eax: code-point <- to-code-point *g + copy-to c, tmp + } + x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, fg, background-color i <- decrement loop } |