about summary refs log tree commit diff stats
path: root/linux/tile
diff options
context:
space:
mode:
Diffstat (limited to 'linux/tile')
-rw-r--r--linux/tile/box.mu4
-rw-r--r--linux/tile/environment.mu114
-rw-r--r--linux/tile/gap-buffer.mu188
-rw-r--r--linux/tile/grapheme-stack.mu124
-rw-r--r--linux/tile/main.mu6
-rw-r--r--linux/tile/surface.mu18
-rw-r--r--linux/tile/value.mu12
-rw-r--r--linux/tile/word.mu48
8 files changed, 257 insertions, 257 deletions
diff --git a/linux/tile/box.mu b/linux/tile/box.mu
index 859d0b8e..f5155ea8 100644
--- a/linux/tile/box.mu
+++ b/linux/tile/box.mu
@@ -78,7 +78,7 @@ fn clear-rect screen: (addr screen), row1: int, col1: int, row2: int, col2: int
     {
       compare j, col2
       break-if->
-      print-grapheme screen 0x20/space
+      print-code-point-utf8 screen 0x20/space
       j <- increment
       loop
     }
@@ -98,7 +98,7 @@ fn clear-rect2 screen: (addr screen), row1: int, col1: int, w: int, h: int {
     {
       compare j, h
       break-if->=
-      print-grapheme screen 0x20/space
+      print-code-point-utf8 screen 0x20/space
       j <- increment
       loop
     }
diff --git a/linux/tile/environment.mu b/linux/tile/environment.mu
index 3c869d3c..1512db6d 100644
--- a/linux/tile/environment.mu
+++ b/linux/tile/environment.mu
@@ -70,7 +70,7 @@ fn initialize-environment-with-fake-screen _self: (addr environment), nrows: int
 # Iterate
 #############
 
-fn process _self: (addr environment), key: grapheme {
+fn process _self: (addr environment), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var fn-name-ah/eax: (addr handle word) <- get self, partial-function-name
   var fn-name/eax: (addr word) <- lookup *fn-name-ah
@@ -102,7 +102,7 @@ fn process _self: (addr environment), key: grapheme {
 }
 
 # collect new name in partial-function-name, and move the cursor to function with that name
-fn process-goto-dialog _self: (addr environment), key: grapheme {
+fn process-goto-dialog _self: (addr environment), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var fn-name-ah/edi: (addr handle word) <- get self, partial-function-name
   # if 'esc' pressed, cancel goto
@@ -130,7 +130,7 @@ fn process-goto-dialog _self: (addr environment), key: grapheme {
   compare key, 0x7f/del  # backspace on Macs
   $process-goto-dialog:backspace: {
     break-if-!=
-    # if not at start, delete grapheme before cursor
+    # if not at start, delete code-point-utf8 before cursor
     var fn-name/eax: (addr word) <- lookup *fn-name-ah
     var at-start?/eax: boolean <- cursor-at-start? fn-name
     compare at-start?, 0/false
@@ -142,24 +142,24 @@ fn process-goto-dialog _self: (addr environment), key: grapheme {
     return
   }
   # otherwise insert key within current word
-  var print?/eax: boolean <- real-grapheme? key
-  $process-goto-dialog:real-grapheme: {
+  var print?/eax: boolean <- real-code-point-utf8? key
+  $process-goto-dialog:real-code-point-utf8: {
     compare print?, 0/false
     break-if-=
     var fn-name/eax: (addr word) <- lookup *fn-name-ah
-    add-grapheme-to-word fn-name, key
+    add-code-point-utf8-to-word fn-name, key
     return
   }
   # silently ignore other hotkeys
 }
 
-fn process-function _self: (addr environment), _function: (addr function), key: grapheme {
+fn process-function _self: (addr environment), _function: (addr function), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var function/edi: (addr function) <- copy _function
   process-function-edit self, function, key
 }
 
-fn process-function-edit _self: (addr environment), _function: (addr function), key: grapheme {
+fn process-function-edit _self: (addr environment), _function: (addr function), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var function/edi: (addr function) <- copy _function
   var cursor-word-ah/ebx: (addr handle word) <- get function, cursor-word
@@ -290,7 +290,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function),
   compare key, 0x7f/del  # backspace on Macs
   $process-function-edit:backspace: {
     break-if-!=
-    # if not at start of some word, delete grapheme before cursor within current word
+    # if not at start of some word, delete code-point-utf8 before cursor within current word
     var at-start?/eax: boolean <- cursor-at-start? cursor-word
     compare at-start?, 0/false
     {
@@ -325,25 +325,25 @@ fn process-function-edit _self: (addr environment), _function: (addr function),
       copy-object new-prev-word-ah, cursor-word-ah
       return
     }
-    # if start of word is quote and grapheme before cursor is not, just insert it as usual
+    # if start of word is quote and code-point-utf8 before cursor is not, just insert it as usual
     # TODO: support string escaping
     {
-      var first-grapheme/eax: grapheme <- first-grapheme cursor-word
-      compare first-grapheme, 0x22/double-quote
+      var first-code-point-utf8/eax: code-point-utf8 <- first-code-point-utf8 cursor-word
+      compare first-code-point-utf8, 0x22/double-quote
       break-if-!=
-      var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
-      compare final-grapheme, 0x22/double-quote
+      var final-code-point-utf8/eax: code-point-utf8 <- code-point-utf8-before-cursor cursor-word
+      compare final-code-point-utf8, 0x22/double-quote
       break-if-=
       break $process-function-edit:space
     }
-    # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual
+    # if start of word is '[' and code-point-utf8 before cursor is not ']', just insert it as usual
     # TODO: support nested arrays
     {
-      var first-grapheme/eax: grapheme <- first-grapheme cursor-word
-      compare first-grapheme, 0x5b/[
+      var first-code-point-utf8/eax: code-point-utf8 <- first-code-point-utf8 cursor-word
+      compare first-code-point-utf8, 0x5b/[
       break-if-!=
-      var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
-      compare final-grapheme, 0x5d/]
+      var final-code-point-utf8/eax: code-point-utf8 <- code-point-utf8-before-cursor cursor-word
+      compare final-code-point-utf8, 0x5d/]
       break-if-=
       break $process-function-edit:space
     }
@@ -368,26 +368,26 @@ fn process-function-edit _self: (addr environment), _function: (addr function),
       var at-end?/eax: boolean <- cursor-at-end? cursor-word
       compare at-end?, 0/false
       break-if-!=
-      var g/eax: grapheme <- pop-after-cursor cursor-word
-      add-grapheme-to-word next-word, g
+      var g/eax: code-point-utf8 <- pop-after-cursor cursor-word
+      add-code-point-utf8-to-word next-word, g
       loop
     }
     cursor-to-start next-word
     return
   }
   # otherwise insert key within current word
-  var g/edx: grapheme <- copy key
-  var print?/eax: boolean <- real-grapheme? key
-  $process-function-edit:real-grapheme: {
+  var g/edx: code-point-utf8 <- copy key
+  var print?/eax: boolean <- real-code-point-utf8? key
+  $process-function-edit:real-code-point-utf8: {
     compare print?, 0/false
     break-if-=
-    add-grapheme-to-word cursor-word, g
+    add-code-point-utf8-to-word cursor-word, g
     return
   }
   # silently ignore other hotkeys
 }
 
-fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: grapheme {
+fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var sandbox/edi: (addr sandbox) <- copy _sandbox
   var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word
@@ -413,7 +413,7 @@ fn process-sandbox _self: (addr environment), _sandbox: (addr sandbox), key: gra
   process-sandbox-edit self, sandbox, key
 }
 
-fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key: grapheme {
+fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key: code-point-utf8 {
   var self/esi: (addr environment) <- copy _self
   var sandbox/edi: (addr sandbox) <- copy _sandbox
   var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
@@ -730,7 +730,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key
   compare key, 0x7f/del  # backspace on Macs
   $process-sandbox-edit:backspace: {
     break-if-!=
-    # if not at start of some word, delete grapheme before cursor within current word
+    # if not at start of some word, delete code-point-utf8 before cursor within current word
     var at-start?/eax: boolean <- cursor-at-start? cursor-word
     compare at-start?, 0/false
     {
@@ -766,25 +766,25 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key
       decrement-final-element cursor-call-path
       return
     }
-    # if start of word is quote and grapheme before cursor is not, just insert it as usual
+    # if start of word is quote and code-point-utf8 before cursor is not, just insert it as usual
     # TODO: support string escaping
     {
-      var first-grapheme/eax: grapheme <- first-grapheme cursor-word
-      compare first-grapheme, 0x22/double-quote
+      var first-code-point-utf8/eax: code-point-utf8 <- first-code-point-utf8 cursor-word
+      compare first-code-point-utf8, 0x22/double-quote
       break-if-!=
-      var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
-      compare final-grapheme, 0x22/double-quote
+      var final-code-point-utf8/eax: code-point-utf8 <- code-point-utf8-before-cursor cursor-word
+      compare final-code-point-utf8, 0x22/double-quote
       break-if-=
       break $process-sandbox-edit:space
     }
-    # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual
+    # if start of word is '[' and code-point-utf8 before cursor is not ']', just insert it as usual
     # TODO: support nested arrays
     {
-      var first-grapheme/eax: grapheme <- first-grapheme cursor-word
-      compare first-grapheme, 0x5b/[
+      var first-code-point-utf8/eax: code-point-utf8 <- first-code-point-utf8 cursor-word
+      compare first-code-point-utf8, 0x5b/[
       break-if-!=
-      var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word
-      compare final-grapheme, 0x5d/]
+      var final-code-point-utf8/eax: code-point-utf8 <- code-point-utf8-before-cursor cursor-word
+      compare final-code-point-utf8, 0x5d/]
       break-if-=
       break $process-sandbox-edit:space
     }
@@ -809,8 +809,8 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key
       var at-end?/eax: boolean <- cursor-at-end? cursor-word
       compare at-end?, 0/false
       break-if-!=
-      var g/eax: grapheme <- pop-after-cursor cursor-word
-      add-grapheme-to-word next-word, g
+      var g/eax: code-point-utf8 <- pop-after-cursor cursor-word
+      add-code-point-utf8-to-word next-word, g
       loop
     }
     cursor-to-start next-word
@@ -838,12 +838,12 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key
     return
   }
   # otherwise insert key within current word
-  var g/edx: grapheme <- copy key
-  var print?/eax: boolean <- real-grapheme? key
-  $process-sandbox-edit:real-grapheme: {
+  var g/edx: code-point-utf8 <- copy key
+  var print?/eax: boolean <- real-code-point-utf8? key
+  $process-sandbox-edit:real-code-point-utf8: {
     compare print?, 0/false
     break-if-=
-    add-grapheme-to-word cursor-word, g
+    add-code-point-utf8-to-word cursor-word, g
     return
   }
   # silently ignore other hotkeys
@@ -852,7 +852,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key
 # collect new name in partial-name-for-cursor-word, and then rename the word
 # at cursor to it
 # Precondition: cursor-call-path is a singleton (not within a call)
-fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
+fn process-sandbox-rename _sandbox: (addr sandbox), key: code-point-utf8 {
   var sandbox/esi: (addr sandbox) <- copy _sandbox
   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word
   # if 'esc' pressed, cancel rename
@@ -911,7 +911,7 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
     {
       var new-name/eax: (addr word) <- lookup *new-name-ah
       cursor-to-start new-name
-      add-grapheme-to-word new-name, 0x3d/=
+      add-code-point-utf8-to-word new-name, 0x3d/=
     }
     # append name to new line
     chain-words new-line-word-ah, new-name-ah
@@ -941,7 +941,7 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
   compare key, 0x7f/del  # backspace on Macs
   $process-sandbox-rename:backspace: {
     break-if-!=
-    # if not at start, delete grapheme before cursor
+    # if not at start, delete code-point-utf8 before cursor
     var new-name/eax: (addr word) <- lookup *new-name-ah
     var at-start?/eax: boolean <- cursor-at-start? new-name
     compare at-start?, 0/false
@@ -953,12 +953,12 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
     return
   }
   # otherwise insert key within current word
-  var print?/eax: boolean <- real-grapheme? key
-  $process-sandbox-rename:real-grapheme: {
+  var print?/eax: boolean <- real-code-point-utf8? key
+  $process-sandbox-rename:real-code-point-utf8: {
     compare print?, 0/false
     break-if-=
     var new-name/eax: (addr word) <- lookup *new-name-ah
-    add-grapheme-to-word new-name, key
+    add-code-point-utf8-to-word new-name, key
     return
   }
   # silently ignore other hotkeys
@@ -968,7 +968,7 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme {
 # of the sandbox to be a new function with that name. Replace the last line
 # with a call to the appropriate function.
 # Precondition: cursor-call-path is a singleton (not within a call)
-fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme {
+fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: code-point-utf8 {
   var sandbox/esi: (addr sandbox) <- copy _sandbox
   var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function
   # if 'esc' pressed, cancel define
@@ -1033,7 +1033,7 @@ fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle func
   compare key, 0x7f/del  # backspace on Macs
   $process-sandbox-define:backspace: {
     break-if-!=
-    # if not at start, delete grapheme before cursor
+    # if not at start, delete code-point-utf8 before cursor
     var new-name/eax: (addr word) <- lookup *new-name-ah
     var at-start?/eax: boolean <- cursor-at-start? new-name
     compare at-start?, 0/false
@@ -1045,12 +1045,12 @@ fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle func
     return
   }
   # otherwise insert key within current word
-  var print?/eax: boolean <- real-grapheme? key
-  $process-sandbox-define:real-grapheme: {
+  var print?/eax: boolean <- real-code-point-utf8? key
+  $process-sandbox-define:real-code-point-utf8: {
     compare print?, 0/false
     break-if-=
     var new-name/eax: (addr word) <- lookup *new-name-ah
-    add-grapheme-to-word new-name, key
+    add-code-point-utf8-to-word new-name, key
     return
   }
   # silently ignore other hotkeys
@@ -2107,7 +2107,7 @@ fn render-function-right-aligned screen: (addr screen), row: int, right-col: int
   start-color screen, 0, 0xf7
   clear-rect screen, row, col, new-row, col2
   col <- add 1
-#?   var dummy/eax: grapheme <- read-key-from-real-keyboard
+#?   var dummy/eax: code-point-utf8 <- read-key-from-real-keyboard
   render-function screen, row, col, f
   new-row <- add 1/function-bottom-margin
   col <- subtract 1/function-left-padding
@@ -2144,7 +2144,7 @@ fn render-function screen: (addr screen), row: int, col: int, _f: (addr function
   render-line-without-stack screen, body, row, col, cursor-word, cursor-row, cursor-col
 }
 
-fn real-grapheme? g: grapheme -> _/eax: boolean {
+fn real-code-point-utf8? g: code-point-utf8 -> _/eax: boolean {
   # if g == newline return true
   compare g, 0xa
   {
diff --git a/linux/tile/gap-buffer.mu b/linux/tile/gap-buffer.mu
index 0132daf0..1441684b 100644
--- a/linux/tile/gap-buffer.mu
+++ b/linux/tile/gap-buffer.mu
@@ -1,14 +1,14 @@
 type gap-buffer {
-  left: grapheme-stack
-  right: grapheme-stack
+  left: code-point-utf8-stack
+  right: code-point-utf8-stack
 }
 
 fn initialize-gap-buffer _self: (addr gap-buffer) {
   var self/esi: (addr gap-buffer) <- copy _self
-  var left/eax: (addr grapheme-stack) <- get self, left
-  initialize-grapheme-stack left, 0x10/max-word-size
-  var right/eax: (addr grapheme-stack) <- get self, right
-  initialize-grapheme-stack right, 0x10/max-word-size
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
+  initialize-code-point-utf8-stack left, 0x10/max-word-size
+  var right/eax: (addr code-point-utf8-stack) <- get self, right
+  initialize-code-point-utf8-stack right, 0x10/max-word-size
 }
 
 # just for tests
@@ -21,8 +21,8 @@ fn initialize-gap-buffer-with self: (addr gap-buffer), s: (addr array byte) {
     var done?/eax: boolean <- stream-empty? stream
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- read-grapheme stream
-    add-grapheme-at-gap self, g
+    var g/eax: code-point-utf8 <- read-code-point-utf8 stream
+    add-code-point-utf8-at-gap self, g
     loop
   }
 }
@@ -37,44 +37,44 @@ fn gap-buffer-to-string self: (addr gap-buffer), out: (addr handle array byte) {
 fn emit-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) {
   var self/esi: (addr gap-buffer) <- copy _self
   clear-stream out
-  var left/eax: (addr grapheme-stack) <- get self, left
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
   emit-stack-from-bottom left, out
-  var right/eax: (addr grapheme-stack) <- get self, right
+  var right/eax: (addr code-point-utf8-stack) <- get self, right
   emit-stack-from-top right, out
 }
 
 # dump stack from bottom to top
-fn emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte) {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream byte) {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/eax: int <- copy 0
   {
     compare i, *top-addr
     break-if->=
-    var g/edx: (addr grapheme) <- index data, i
-    write-grapheme out, *g
+    var g/edx: (addr code-point-utf8) <- index data, i
+    write-code-point-utf8 out, *g
     i <- increment
     loop
   }
 }
 
 # dump stack from top to bottom
-fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream byte) {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/eax: int <- copy *top-addr
   i <- decrement
   {
     compare i, 0
     break-if-<
-    var g/edx: (addr grapheme) <- index data, i
-    write-grapheme out, *g
+    var g/edx: (addr code-point-utf8) <- index data, i
+    write-code-point-utf8 out, *g
     i <- decrement
     loop
   }
@@ -82,33 +82,33 @@ fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
 
 fn render-gap-buffer screen: (addr screen), _gap: (addr gap-buffer) {
   var gap/esi: (addr gap-buffer) <- copy _gap
-  var left/eax: (addr grapheme-stack) <- get gap, left
+  var left/eax: (addr code-point-utf8-stack) <- get gap, left
   render-stack-from-bottom left, screen
-  var right/eax: (addr grapheme-stack) <- get gap, right
+  var right/eax: (addr code-point-utf8-stack) <- get gap, right
   render-stack-from-top right, screen
 }
 
 fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int {
   var gap/esi: (addr gap-buffer) <- copy _gap
-  var left/eax: (addr grapheme-stack) <- get gap, left
+  var left/eax: (addr code-point-utf8-stack) <- get gap, left
   var tmp/eax: (addr int) <- get left, top
   var left-length/ecx: int <- copy *tmp
-  var right/esi: (addr grapheme-stack) <- get gap, right
+  var right/esi: (addr code-point-utf8-stack) <- get gap, right
   tmp <- get right, top
   var result/eax: int <- copy *tmp
   result <- add left-length
   return result
 }
 
-fn add-grapheme-at-gap _self: (addr gap-buffer), g: grapheme {
+fn add-code-point-utf8-at-gap _self: (addr gap-buffer), g: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
-  var left/eax: (addr grapheme-stack) <- get self, left
-  push-grapheme-stack left, g
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
+  push-code-point-utf8-stack left, g
 }
 
 fn gap-to-start self: (addr gap-buffer) {
   {
-    var curr/eax: grapheme <- gap-left self
+    var curr/eax: code-point-utf8 <- gap-left self
     compare curr, -1
     loop-if-!=
   }
@@ -116,7 +116,7 @@ fn gap-to-start self: (addr gap-buffer) {
 
 fn gap-to-end self: (addr gap-buffer) {
   {
-    var curr/eax: grapheme <- gap-right self
+    var curr/eax: code-point-utf8 <- gap-right self
     compare curr, -1
     loop-if-!=
   }
@@ -124,96 +124,96 @@ fn gap-to-end self: (addr gap-buffer) {
 
 fn gap-at-start? _self: (addr gap-buffer) -> _/eax: boolean {
   var self/esi: (addr gap-buffer) <- copy _self
-  var left/eax: (addr grapheme-stack) <- get self, left
-  var result/eax: boolean <- grapheme-stack-empty? left
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
+  var result/eax: boolean <- code-point-utf8-stack-empty? left
   return result
 }
 
 fn gap-at-end? _self: (addr gap-buffer) -> _/eax: boolean {
   var self/esi: (addr gap-buffer) <- copy _self
-  var right/eax: (addr grapheme-stack) <- get self, right
-  var result/eax: boolean <- grapheme-stack-empty? right
+  var right/eax: (addr code-point-utf8-stack) <- get self, right
+  var result/eax: boolean <- code-point-utf8-stack-empty? right
   return result
 }
 
-fn gap-right _self: (addr gap-buffer) -> _/eax: grapheme {
+fn gap-right _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
-  var g/eax: grapheme <- copy 0
-  var right/ecx: (addr grapheme-stack) <- get self, right
-  g <- pop-grapheme-stack right
+  var g/eax: code-point-utf8 <- copy 0
+  var right/ecx: (addr code-point-utf8-stack) <- get self, right
+  g <- pop-code-point-utf8-stack right
   compare g, -1
   {
     break-if-=
-    var left/ecx: (addr grapheme-stack) <- get self, left
-    push-grapheme-stack left, g
+    var left/ecx: (addr code-point-utf8-stack) <- get self, left
+    push-code-point-utf8-stack left, g
   }
   return g
 }
 
-fn gap-left _self: (addr gap-buffer) -> _/eax: grapheme {
+fn gap-left _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
-  var g/eax: grapheme <- copy 0
+  var g/eax: code-point-utf8 <- copy 0
   {
-    var left/ecx: (addr grapheme-stack) <- get self, left
-    g <- pop-grapheme-stack left
+    var left/ecx: (addr code-point-utf8-stack) <- get self, left
+    g <- pop-code-point-utf8-stack left
   }
   compare g, -1
   {
     break-if-=
-    var right/ecx: (addr grapheme-stack) <- get self, right
-    push-grapheme-stack right, g
+    var right/ecx: (addr code-point-utf8-stack) <- get self, right
+    push-code-point-utf8-stack right, g
   }
   return g
 }
 
 fn gap-index _self: (addr gap-buffer) -> _/eax: int {
   var self/eax: (addr gap-buffer) <- copy _self
-  var left/eax: (addr grapheme-stack) <- get self, left
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
   var top-addr/eax: (addr int) <- get left, top
   var result/eax: int <- copy *top-addr
   return result
 }
 
-fn first-grapheme-in-gap-buffer _self: (addr gap-buffer) -> _/eax: grapheme {
+fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
   # try to read from left
-  var left/eax: (addr grapheme-stack) <- get self, left
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
   var top-addr/ecx: (addr int) <- get left, top
   compare *top-addr, 0
   {
     break-if-<=
-    var data-ah/eax: (addr handle array grapheme) <- get left, data
-    var data/eax: (addr array grapheme) <- lookup *data-ah
-    var result-addr/eax: (addr grapheme) <- index data, 0
+    var data-ah/eax: (addr handle array code-point-utf8) <- get left, data
+    var data/eax: (addr array code-point-utf8) <- lookup *data-ah
+    var result-addr/eax: (addr code-point-utf8) <- index data, 0
     return *result-addr
   }
   # try to read from right
-  var right/eax: (addr grapheme-stack) <- get self, right
+  var right/eax: (addr code-point-utf8-stack) <- get self, right
   top-addr <- get right, top
   compare *top-addr, 0
   {
     break-if-<=
-    var data-ah/eax: (addr handle array grapheme) <- get right, data
-    var data/eax: (addr array grapheme) <- lookup *data-ah
+    var data-ah/eax: (addr handle array code-point-utf8) <- get right, data
+    var data/eax: (addr array code-point-utf8) <- lookup *data-ah
     var top/ecx: int <- copy *top-addr
     top <- decrement
-    var result-addr/eax: (addr grapheme) <- index data, top
+    var result-addr/eax: (addr code-point-utf8) <- index data, top
     return *result-addr
   }
   # give up
   return -1
 }
 
-fn grapheme-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: grapheme {
+fn code-point-utf8-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
   # try to read from left
-  var left/ecx: (addr grapheme-stack) <- get self, left
+  var left/ecx: (addr code-point-utf8-stack) <- get self, left
   var top-addr/edx: (addr int) <- get left, top
   compare *top-addr, 0
   {
     break-if-<=
-    var result/eax: grapheme <- pop-grapheme-stack left
-    push-grapheme-stack left, result
+    var result/eax: code-point-utf8 <- pop-code-point-utf8-stack left
+    push-code-point-utf8-stack left, result
     return result
   }
   # give up
@@ -222,27 +222,27 @@ fn grapheme-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: graph
 
 fn delete-before-gap _self: (addr gap-buffer) {
   var self/eax: (addr gap-buffer) <- copy _self
-  var left/eax: (addr grapheme-stack) <- get self, left
-  var dummy/eax: grapheme <- pop-grapheme-stack left
+  var left/eax: (addr code-point-utf8-stack) <- get self, left
+  var dummy/eax: code-point-utf8 <- pop-code-point-utf8-stack left
 }
 
-fn pop-after-gap _self: (addr gap-buffer) -> _/eax: grapheme {
+fn pop-after-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/eax: (addr gap-buffer) <- copy _self
-  var right/eax: (addr grapheme-stack) <- get self, right
-  var result/eax: grapheme <- pop-grapheme-stack right
+  var right/eax: (addr code-point-utf8-stack) <- get self, right
+  var result/eax: code-point-utf8 <- pop-code-point-utf8-stack right
   return result
 }
 
 fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: boolean {
   var self/esi: (addr gap-buffer) <- copy _self
-  # complication: graphemes may be multiple bytes
+  # complication: code-point-utf8s may be multiple bytes
   # so don't rely on length
   # instead turn the expected result into a stream and arrange to read from it in order
   var stream-storage: (stream byte 0x10/max-word-size)
   var expected-stream/ecx: (addr stream byte) <- address stream-storage
   write expected-stream, s
   # compare left
-  var left/edx: (addr grapheme-stack) <- get self, left
+  var left/edx: (addr code-point-utf8-stack) <- get self, left
   var result/eax: boolean <- prefix-match? left, expected-stream
   compare result, 0/false
   {
@@ -250,7 +250,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo
     return result
   }
   # compare right
-  var right/edx: (addr grapheme-stack) <- get self, right
+  var right/edx: (addr code-point-utf8-stack) <- get self, right
   result <- suffix-match? right, expected-stream
   compare result, 0/false
   {
@@ -267,10 +267,10 @@ fn test-gap-buffer-equal-from-end? {
   var g/esi: (addr gap-buffer) <- address _g
   initialize-gap-buffer g
   #
-  var c/eax: grapheme <- copy 0x61/a
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
+  var c/eax: code-point-utf8 <- copy 0x61/a
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
   # gap is at end (right is empty)
   var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
   var result/eax: int <- copy _result
@@ -282,11 +282,11 @@ fn test-gap-buffer-equal-from-middle? {
   var g/esi: (addr gap-buffer) <- address _g
   initialize-gap-buffer g
   #
-  var c/eax: grapheme <- copy 0x61/a
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
-  var dummy/eax: grapheme <- gap-left g
+  var c/eax: code-point-utf8 <- copy 0x61/a
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
+  var dummy/eax: code-point-utf8 <- gap-left g
   # gap is in the middle
   var _result/eax: boolean <- gap-buffer-equal? g, "aaa"
   var result/eax: int <- copy _result
@@ -298,11 +298,11 @@ fn test-gap-buffer-equal-from-start? {
   var g/esi: (addr gap-buffer) <- address _g
   initialize-gap-buffer g
   #
-  var c/eax: grapheme <- copy 0x61/a
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
-  add-grapheme-at-gap g, c
-  var dummy/eax: grapheme <- gap-left g
+  var c/eax: code-point-utf8 <- copy 0x61/a
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
+  add-code-point-utf8-at-gap g, c
+  var dummy/eax: code-point-utf8 <- gap-left g
   dummy <- gap-left g
   dummy <- gap-left g
   # gap is at the start
@@ -319,25 +319,25 @@ fn copy-gap-buffer _src-ah: (addr handle gap-buffer), _dest-ah: (addr handle gap
   var dest-ah/eax: (addr handle gap-buffer) <- copy _dest-ah
   var _dest-a/eax: (addr gap-buffer) <- lookup *dest-ah
   var dest-a/edi: (addr gap-buffer) <- copy _dest-a
-  # copy left grapheme-stack
-  var src/ecx: (addr grapheme-stack) <- get src-a, left
-  var dest/edx: (addr grapheme-stack) <- get dest-a, left
-  copy-grapheme-stack src, dest
-  # copy right grapheme-stack
+  # copy left code-point-utf8-stack
+  var src/ecx: (addr code-point-utf8-stack) <- get src-a, left
+  var dest/edx: (addr code-point-utf8-stack) <- get dest-a, left
+  copy-code-point-utf8-stack src, dest
+  # copy right code-point-utf8-stack
   src <- get src-a, right
   dest <- get dest-a, right
-  copy-grapheme-stack src, dest
+  copy-code-point-utf8-stack src, dest
 }
 
 fn gap-buffer-is-decimal-integer? _self: (addr gap-buffer) -> _/eax: boolean {
   var self/esi: (addr gap-buffer) <- copy _self
-  var curr/ecx: (addr grapheme-stack) <- get self, left
-  var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
+  var curr/ecx: (addr code-point-utf8-stack) <- get self, left
+  var result/eax: boolean <- code-point-utf8-stack-is-decimal-integer? curr
   {
     compare result, 0/false
     break-if-=
     curr <- get self, right
-    result <- grapheme-stack-is-decimal-integer? curr
+    result <- code-point-utf8-stack-is-decimal-integer? curr
   }
   return result
 }
diff --git a/linux/tile/grapheme-stack.mu b/linux/tile/grapheme-stack.mu
index 0ea59ae5..c7565a1c 100644
--- a/linux/tile/grapheme-stack.mu
+++ b/linux/tile/grapheme-stack.mu
@@ -1,24 +1,24 @@
-type grapheme-stack {
-  data: (handle array grapheme)
+type code-point-utf8-stack {
+  data: (handle array code-point-utf8)
   top: int
 }
 
-fn initialize-grapheme-stack _self: (addr grapheme-stack), n: int {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var d/edi: (addr handle array grapheme) <- get self, data
+fn initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var d/edi: (addr handle array code-point-utf8) <- get self, data
   populate d, n
   var top/eax: (addr int) <- get self, top
   copy-to *top, 0
 }
 
-fn clear-grapheme-stack _self: (addr grapheme-stack) {
-  var self/esi: (addr grapheme-stack) <- copy _self
+fn clear-code-point-utf8-stack _self: (addr code-point-utf8-stack) {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
   var top/eax: (addr int) <- get self, top
   copy-to *top, 0
 }
 
-fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
-  var self/esi: (addr grapheme-stack) <- copy _self
+fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
   var top/eax: (addr int) <- get self, top
   compare *top, 0
   {
@@ -28,20 +28,20 @@ fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
   return 0/false
 }
 
-fn push-grapheme-stack _self: (addr grapheme-stack), _val: grapheme {
-  var self/esi: (addr grapheme-stack) <- copy _self
+fn push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-point-utf8 {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
   var top-addr/ecx: (addr int) <- get self, top
-  var data-ah/edx: (addr handle array grapheme) <- get self, data
-  var data/eax: (addr array grapheme) <- lookup *data-ah
+  var data-ah/edx: (addr handle array code-point-utf8) <- get self, data
+  var data/eax: (addr array code-point-utf8) <- lookup *data-ah
   var top/edx: int <- copy *top-addr
-  var dest-addr/edx: (addr grapheme) <- index data, top
-  var val/eax: grapheme <- copy _val
+  var dest-addr/edx: (addr code-point-utf8) <- index data, top
+  var val/eax: code-point-utf8 <- copy _val
   copy-to *dest-addr, val
   add-to *top-addr, 1
 }
 
-fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: grapheme {
-  var self/esi: (addr grapheme-stack) <- copy _self
+fn pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-point-utf8 {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
   var top-addr/ecx: (addr int) <- get self, top
   {
     compare *top-addr, 0
@@ -49,25 +49,25 @@ fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: grapheme {
     return -1
   }
   subtract-from *top-addr, 1
-  var data-ah/edx: (addr handle array grapheme) <- get self, data
-  var data/eax: (addr array grapheme) <- lookup *data-ah
+  var data-ah/edx: (addr handle array code-point-utf8) <- get self, data
+  var data/eax: (addr array code-point-utf8) <- lookup *data-ah
   var top/edx: int <- copy *top-addr
-  var result-addr/eax: (addr grapheme) <- index data, top
+  var result-addr/eax: (addr code-point-utf8) <- index data, top
   return *result-addr
 }
 
-fn copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack) {
-  var src/esi: (addr grapheme-stack) <- copy _src
-  var data-ah/edi: (addr handle array grapheme) <- get src, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr code-point-utf8-stack) {
+  var src/esi: (addr code-point-utf8-stack) <- copy _src
+  var data-ah/edi: (addr handle array code-point-utf8) <- get src, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get src, top
   var i/eax: int <- copy 0
   {
     compare i, *top-addr
     break-if->=
-    var g/edx: (addr grapheme) <- index data, i
-    push-grapheme-stack dest, *g
+    var g/edx: (addr code-point-utf8) <- index data, i
+    push-code-point-utf8-stack dest, *g
     i <- increment
     loop
   }
@@ -75,18 +75,18 @@ fn copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack)
 
 # dump stack to screen from bottom to top
 # don't move the cursor or anything
-fn render-stack-from-bottom _self: (addr grapheme-stack), screen: (addr screen) {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn render-stack-from-bottom _self: (addr code-point-utf8-stack), screen: (addr screen) {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/eax: int <- copy 0
   {
     compare i, *top-addr
     break-if->=
-    var g/edx: (addr grapheme) <- index data, i
-    print-grapheme screen, *g
+    var g/edx: (addr code-point-utf8) <- index data, i
+    print-code-point-utf8 screen, *g
     i <- increment
     loop
   }
@@ -94,19 +94,19 @@ fn render-stack-from-bottom _self: (addr grapheme-stack), screen: (addr screen)
 
 # dump stack to screen from top to bottom
 # don't move the cursor or anything
-fn render-stack-from-top _self: (addr grapheme-stack), screen: (addr screen) {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn render-stack-from-top _self: (addr code-point-utf8-stack), screen: (addr screen) {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/eax: int <- copy *top-addr
   i <- decrement
   {
     compare i, 0
     break-if-<
-    var g/edx: (addr grapheme) <- index data, i
-    print-grapheme screen, *g
+    var g/edx: (addr code-point-utf8) <- index data, i
+    print-code-point-utf8 screen, *g
     i <- decrement
     loop
   }
@@ -114,11 +114,11 @@ fn render-stack-from-top _self: (addr grapheme-stack), screen: (addr screen) {
 
 # compare from bottom
 # beware: modifies 'stream', which must be disposed of after a false result
-fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/ebx: int <- copy 0
   {
@@ -126,8 +126,8 @@ fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b
     break-if->=
     # if curr != expected, return false
     {
-      var curr-a/edx: (addr grapheme) <- index data, i
-      var expected/eax: grapheme <- read-grapheme s
+      var curr-a/edx: (addr code-point-utf8) <- index data, i
+      var expected/eax: code-point-utf8 <- read-code-point-utf8 s
       {
         compare expected, *curr-a
         break-if-=
@@ -142,11 +142,11 @@ fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b
 
 # compare from bottom
 # beware: modifies 'stream', which must be disposed of after a false result
-fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/edi: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edi: (addr array grapheme) <- copy _data
+fn suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edi: (addr array code-point-utf8) <- copy _data
   var top-addr/eax: (addr int) <- get self, top
   var i/ebx: int <- copy *top-addr
   i <- decrement
@@ -154,8 +154,8 @@ fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b
     compare i, 0
     break-if-<
     {
-      var curr-a/edx: (addr grapheme) <- index data, i
-      var expected/eax: grapheme <- read-grapheme s
+      var curr-a/edx: (addr code-point-utf8) <- index data, i
+      var expected/eax: code-point-utf8 <- read-code-point-utf8 s
       # if curr != expected, return false
       {
         compare expected, *curr-a
@@ -169,18 +169,18 @@ fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b
   return 1   # true
 }
 
-fn grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boolean {
-  var self/esi: (addr grapheme-stack) <- copy _self
-  var data-ah/eax: (addr handle array grapheme) <- get self, data
-  var _data/eax: (addr array grapheme) <- lookup *data-ah
-  var data/edx: (addr array grapheme) <- copy _data
+fn code-point-utf8-stack-is-decimal-integer? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
+  var self/esi: (addr code-point-utf8-stack) <- copy _self
+  var data-ah/eax: (addr handle array code-point-utf8) <- get self, data
+  var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
+  var data/edx: (addr array code-point-utf8) <- copy _data
   var top-addr/ecx: (addr int) <- get self, top
   var i/ebx: int <- copy 0
   var result/eax: boolean <- copy 1/true
-  $grapheme-stack-is-integer?:loop: {
+  $code-point-utf8-stack-is-integer?:loop: {
     compare i, *top-addr
     break-if->=
-    var g/edx: (addr grapheme) <- index data, i
+    var g/edx: (addr code-point-utf8) <- index data, i
     result <- decimal-digit? *g
     compare result, 0/false
     break-if-=
diff --git a/linux/tile/main.mu b/linux/tile/main.mu
index e0daaf1b..f2561a28 100644
--- a/linux/tile/main.mu
+++ b/linux/tile/main.mu
@@ -54,7 +54,7 @@ fn interactive {
   initialize-environment env
   {
     render env
-    var key/eax: grapheme <- read-key-from-real-keyboard
+    var key/eax: code-point-utf8 <- read-key-from-real-keyboard
     compare key, 0x11/ctrl-q
     break-if-=
     process env, key
@@ -79,7 +79,7 @@ fn process-all env: (addr environment), cmds: (addr array byte) {
     var done?/eax: boolean <- stream-empty? cmds-stream-a
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- read-grapheme cmds-stream-a
+    var g/eax: code-point-utf8 <- read-code-point-utf8 cmds-stream-a
     process env, g
     loop
   }
@@ -105,7 +105,7 @@ fn repl {
       var done?/eax: boolean <- stream-empty? line
       compare done?, 0/false
       break-if-!=
-      var g/eax: grapheme <- read-grapheme line
+      var g/eax: code-point-utf8 <- read-code-point-utf8 line
       process env, g
       loop
     }
diff --git a/linux/tile/surface.mu b/linux/tile/surface.mu
index 2e353022..e86e22b9 100644
--- a/linux/tile/surface.mu
+++ b/linux/tile/surface.mu
@@ -111,10 +111,10 @@ fn print-surface-cell-at _self: (addr surface), screen-row: int, screen-col: int
   compare idx, 0
   {
     break-if->=
-    var space/ecx: grapheme <- copy 0x20
+    var space/ecx: code-point-utf8 <- copy 0x20
     var screen-ah/edi: (addr handle screen) <- get self, screen
     var screen/eax: (addr screen) <- lookup *screen-ah
-    print-grapheme screen, space
+    print-code-point-utf8 screen, space
     return
   }
   # otherwise print the appropriate screen-cell
@@ -156,9 +156,9 @@ fn print-screen-cell screen: (addr screen), _cell: (addr screen-cell) {
     break-if-=
     start-blinking screen
   }
-  var g/eax: (addr grapheme) <- get cell, data
-  print-grapheme screen, *g
-#?   var g2/eax: grapheme <- copy *g
+  var g/eax: (addr code-point-utf8) <- get cell, data
+  print-code-point-utf8 screen, *g
+#?   var g2/eax: code-point-utf8 <- copy *g
 #?   var g3/eax: int <- copy g2
 #?   print-int32-hex-to-real-screen g3
 #?   print-string-to-real-screen "\n"
@@ -264,7 +264,7 @@ fn num-lines in: (addr array byte) -> _/ecx: int {
     var done?/eax: boolean <- stream-empty? s-addr
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- read-grapheme s-addr
+    var g/eax: code-point-utf8 <- read-code-point-utf8 s-addr
     compare g, 0xa/newline
     loop-if-!=
     result <- increment
@@ -282,7 +282,7 @@ fn first-line-length in: (addr array byte) -> _/edx: int {
     var done?/eax: boolean <- stream-empty? s-addr
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- read-grapheme s-addr
+    var g/eax: code-point-utf8 <- read-code-point-utf8 s-addr
     compare g, 0xa/newline
     break-if-=
     result <- increment
@@ -301,12 +301,12 @@ fn fill-in _out: (addr array screen-cell), in: (addr array byte) {
     var done?/eax: boolean <- stream-empty? s-addr
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- read-grapheme s-addr
+    var g/eax: code-point-utf8 <- read-code-point-utf8 s-addr
     compare g, 0xa/newline
     loop-if-=
     var offset/edx: (offset screen-cell) <- compute-offset out, idx
     var dest/edx: (addr screen-cell) <- index out, offset
-    var dest2/edx: (addr grapheme) <- get dest, data
+    var dest2/edx: (addr code-point-utf8) <- get dest, data
     copy-to *dest2, g
     idx <- increment
     loop
diff --git a/linux/tile/value.mu b/linux/tile/value.mu
index 8bd01676..0eacd8be 100644
--- a/linux/tile/value.mu
+++ b/linux/tile/value.mu
@@ -90,15 +90,15 @@ fn render-number screen: (addr screen), val: float, top-level?: boolean {
     fg <- copy 0
   }
   start-color screen, fg, bg
-  print-grapheme screen, 0x20/space
+  print-code-point-utf8 screen, 0x20/space
   print-float-decimal-approximate screen, val, 3
-  print-grapheme screen, 0x20/space
+  print-code-point-utf8 screen, 0x20/space
 }
 
 fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) {
   start-color screen, 0xf2, 7
   # don't surround in spaces
-  print-grapheme screen, 0x5b/[
+  print-code-point-utf8 screen, 0x5b/[
   increment col
   var a/esi: (addr array value) <- copy _a
   var max/ecx: int <- length a
@@ -122,7 +122,7 @@ fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array va
     i <- increment
     loop
   }
-  print-grapheme screen, 0x5d/]
+  print-code-point-utf8 screen, 0x5d/]
 }
 
 fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (addr screen) {
@@ -179,13 +179,13 @@ fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen
     start-blinking screen
     start-color screen, 0, 1
   }
-  var g/eax: grapheme <- screen-grapheme-at target, row, col
+  var g/eax: code-point-utf8 <- screen-code-point-utf8-at target, row, col
   {
     compare g, 0
     break-if-!=
     g <- copy 0x20/space
   }
-  print-grapheme screen, g
+  print-code-point-utf8 screen, g
   reset-formatting screen
 }
 
diff --git a/linux/tile/word.mu b/linux/tile/word.mu
index b4f5000b..3b4851f0 100644
--- a/linux/tile/word.mu
+++ b/linux/tile/word.mu
@@ -58,15 +58,15 @@ fn move-word-contents _src-ah: (addr handle word), _dest-ah: (addr handle word)
   cursor-to-start src
   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
-  var src-stack/ecx: (addr grapheme-stack) <- get src-data, right
+  var src-stack/ecx: (addr code-point-utf8-stack) <- get src-data, right
   {
-    var done?/eax: boolean <- grapheme-stack-empty? src-stack
+    var done?/eax: boolean <- code-point-utf8-stack-empty? src-stack
     compare done?, 0/false
     break-if-!=
-    var g/eax: grapheme <- pop-grapheme-stack src-stack
-#?     print-grapheme 0, g
+    var g/eax: code-point-utf8 <- pop-code-point-utf8-stack src-stack
+#?     print-code-point-utf8 0, g
 #?     print-string 0, "\n"
-    add-grapheme-to-word dest, g
+    add-code-point-utf8-to-word dest, g
     loop
   }
 }
@@ -79,17 +79,17 @@ fn copy-word-contents-before-cursor _src-ah: (addr handle word), _dest-ah: (addr
   var src/eax: (addr word) <- lookup *src-ah
   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
-  var src-stack/ecx: (addr grapheme-stack) <- get src-data, left
-  var src-stack-data-ah/eax: (addr handle array grapheme) <- get src-stack, data
-  var _src-stack-data/eax: (addr array grapheme) <- lookup *src-stack-data-ah
-  var src-stack-data/edx: (addr array grapheme) <- copy _src-stack-data
+  var src-stack/ecx: (addr code-point-utf8-stack) <- get src-data, left
+  var src-stack-data-ah/eax: (addr handle array code-point-utf8) <- get src-stack, data
+  var _src-stack-data/eax: (addr array code-point-utf8) <- lookup *src-stack-data-ah
+  var src-stack-data/edx: (addr array code-point-utf8) <- copy _src-stack-data
   var top-addr/ecx: (addr int) <- get src-stack, top
   var i/eax: int <- copy 0
   {
     compare i, *top-addr
     break-if->=
-    var g/edx: (addr grapheme) <- index src-stack-data, i
-    add-grapheme-to-word dest, *g
+    var g/edx: (addr code-point-utf8) <- index src-stack-data, i
+    add-code-point-utf8-to-word dest, *g
     i <- increment
     loop
   }
@@ -129,27 +129,27 @@ fn final-word _in: (addr handle word), out: (addr handle word) {
   copy-object curr-ah, out  # modify 'out' right at the end, just in case it's same as 'in'
 }
 
-fn first-grapheme _self: (addr word) -> _/eax: grapheme {
+fn first-code-point-utf8 _self: (addr word) -> _/eax: code-point-utf8 {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  var result/eax: grapheme <- first-grapheme-in-gap-buffer data
+  var result/eax: code-point-utf8 <- first-code-point-utf8-in-gap-buffer data
   return result
 }
 
-fn grapheme-before-cursor _self: (addr word) -> _/eax: grapheme {
+fn code-point-utf8-before-cursor _self: (addr word) -> _/eax: code-point-utf8 {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  var result/eax: grapheme <- grapheme-before-cursor-in-gap-buffer data
+  var result/eax: code-point-utf8 <- code-point-utf8-before-cursor-in-gap-buffer data
   return result
 }
 
-fn add-grapheme-to-word _self: (addr word), c: grapheme {
+fn add-code-point-utf8-to-word _self: (addr word), c: code-point-utf8 {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  add-grapheme-at-gap data, c
+  add-code-point-utf8-at-gap data, c
 }
 
 fn cursor-at-start? _self: (addr word) -> _/eax: boolean {
@@ -172,14 +172,14 @@ fn cursor-left _self: (addr word) {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  var dummy/eax: grapheme <- gap-left data
+  var dummy/eax: code-point-utf8 <- gap-left data
 }
 
 fn cursor-right _self: (addr word) {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  var dummy/eax: grapheme <- gap-right data
+  var dummy/eax: code-point-utf8 <- gap-right data
 }
 
 fn cursor-to-start _self: (addr word) {
@@ -211,11 +211,11 @@ fn delete-before-cursor _self: (addr word) {
   delete-before-gap data
 }
 
-fn pop-after-cursor _self: (addr word) -> _/eax: grapheme {
+fn pop-after-cursor _self: (addr word) -> _/eax: code-point-utf8 {
   var self/esi: (addr word) <- copy _self
   var data-ah/eax: (addr handle gap-buffer) <- get self, scalar-data
   var data/eax: (addr gap-buffer) <- lookup *data-ah
-  var result/eax: grapheme <- pop-after-gap data
+  var result/eax: code-point-utf8 <- pop-after-gap data
   return result
 }
 
@@ -553,14 +553,14 @@ fn parse-words in: (addr array byte), out-ah: (addr handle word) {
     var done?/eax: boolean <- stream-empty? in-stream-a
     compare done?, 0/false
     break-if-!=
-    var _g/eax: grapheme <- read-grapheme in-stream-a
-    var g/ecx: grapheme <- copy _g
+    var _g/eax: code-point-utf8 <- read-code-point-utf8 in-stream-a
+    var g/ecx: code-point-utf8 <- copy _g
     # if not space, insert
     compare g, 0x20/space
     {
       break-if-=
       var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
-      add-grapheme-to-word cursor-word, g
+      add-code-point-utf8-to-word cursor-word, g
       loop $parse-words:loop
     }
     # otherwise insert word after and move cursor to it