diff --git a/513grapheme-stack.mu b/513grapheme-stack.mu index 3aa0fd4e..5792e08c 100644 --- a/513grapheme-stack.mu +++ b/513grapheme-stack.mu @@ -1,26 +1,26 @@ # code-point-utf8 stacks are the smallest unit of editable text -type code-point-utf8-stack { +type grapheme-stack { data: (handle array code-point-utf8) top: int } -fn initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn initialize-grapheme-stack _self: (addr grapheme-stack), n: int { + var self/esi: (addr grapheme-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-code-point-utf8-stack _self: (addr code-point-utf8-stack) { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn clear-grapheme-stack _self: (addr grapheme-stack) { + var self/esi: (addr grapheme-stack) <- copy _self var top/eax: (addr int) <- get self, top copy-to *top, 0 } -fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean { + var self/esi: (addr grapheme-stack) <- copy _self var top/eax: (addr int) <- get self, top compare *top, 0 { @@ -30,14 +30,14 @@ fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: bo return 0/false } -fn code-point-utf8-stack-length _self: (addr code-point-utf8-stack) -> _/eax: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn grapheme-stack-length _self: (addr grapheme-stack) -> _/eax: int { + var self/esi: (addr grapheme-stack) <- copy _self var top/eax: (addr int) <- get self, top return *top } -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 +fn push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8 { + var self/esi: (addr grapheme-stack) <- copy _self var top-addr/ecx: (addr int) <- get self, top var data-ah/edx: (addr handle array code-point-utf8) <- get self, data var data/eax: (addr array code-point-utf8) <- lookup *data-ah @@ -48,8 +48,8 @@ fn push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-po add-to *top-addr, 1 } -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 +fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8 { + var self/esi: (addr grapheme-stack) <- copy _self var top-addr/ecx: (addr int) <- get self, top { compare *top-addr, 0 @@ -64,8 +64,8 @@ fn pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code- return *result-addr } -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 +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 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 @@ -75,7 +75,7 @@ fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr co compare i, *top-addr break-if->= var g/edx: (addr code-point-utf8) <- index data, i - push-code-point-utf8-stack dest, *g + push-grapheme-stack dest, *g i <- increment loop } @@ -84,8 +84,8 @@ fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr co # dump stack to screen from bottom to top # hardcoded colors: # matching paren -fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int { + var self/esi: (addr grapheme-stack) <- copy _self var matching-open-paren-index/edx: int <- get-matching-open-paren-index self, highlight-matching-open-paren?, open-paren-depth var data-ah/edi: (addr handle array code-point-utf8) <- get self, data var _data/eax: (addr array code-point-utf8) <- lookup *data-ah @@ -123,7 +123,7 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel } # helper for small words -fn render-stack-from-bottom screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int { +fn render-stack-from-bottom screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int { var _width/eax: int <- copy 0 var _height/ecx: int <- copy 0 _width, _height <- screen-size screen @@ -140,8 +140,8 @@ fn render-stack-from-bottom screen: (addr screen), self: (addr code-point-utf8-s # hard-coded colors: # matching paren # cursor -fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int { + var self/esi: (addr grapheme-stack) <- copy _self var matching-close-paren-index/edx: int <- get-matching-close-paren-index self, render-cursor? var data-ah/eax: (addr handle array code-point-utf8) <- get self, data var _data/eax: (addr array code-point-utf8) <- lookup *data-ah @@ -196,7 +196,7 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: } # helper for small words -fn render-stack-from-top screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int { +fn render-stack-from-top screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int { var _width/eax: int <- copy 0 var _height/ecx: int <- copy 0 _width, _height <- screen-size screen @@ -208,190 +208,190 @@ fn render-stack-from-top screen: (addr screen), self: (addr code-point-utf8-stac return x2 # y2? yolo } -fn test-render-code-point-utf8-stack { +fn test-render-grapheme-stack { # setup: gs = "abc" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 5 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 5 var g/eax: code-point-utf8 <- copy 0x61/a - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x63/c - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 0/y, 0/no-highlight-matching-open-paren, 0/open-paren-depth - check-screen-row screen, 0/y, "abc ", "F - test-render-code-point-utf8-stack from bottom" - check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from bottom: result" - check-background-color-in-screen-row screen, 3/bg=reverse, 0/y, " ", "F - test-render-code-point-utf8-stack from bottom: bg" + check-screen-row screen, 0/y, "abc ", "F - test-render-grapheme-stack from bottom" + check-ints-equal x, 3, "F - test-render-grapheme-stack from bottom: result" + check-background-color-in-screen-row screen, 3/bg=reverse, 0/y, " ", "F - test-render-grapheme-stack from bottom: bg" # var x/eax: int <- render-stack-from-top screen, gs, 0/x, 1/y, 0/cursor=false - check-screen-row screen, 1/y, "cba ", "F - test-render-code-point-utf8-stack from top without cursor" - check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from top without cursor: result" - check-background-color-in-screen-row screen, 3/bg=reverse, 1/y, " ", "F - test-render-code-point-utf8-stack from top without cursor: bg" + check-screen-row screen, 1/y, "cba ", "F - test-render-grapheme-stack from top without cursor" + check-ints-equal x, 3, "F - test-render-grapheme-stack from top without cursor: result" + check-background-color-in-screen-row screen, 3/bg=reverse, 1/y, " ", "F - test-render-grapheme-stack from top without cursor: bg" # var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true - check-screen-row screen, 2/y, "cba ", "F - test-render-code-point-utf8-stack from top with cursor" - check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from top with cursor: result" - check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-code-point-utf8-stack from top with cursor: bg" + check-screen-row screen, 2/y, "cba ", "F - test-render-grapheme-stack from top with cursor" + check-ints-equal x, 3, "F - test-render-grapheme-stack from top with cursor: result" + check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-grapheme-stack from top with cursor: bg" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-close-paren { +fn test-render-grapheme-stack-while-highlighting-matching-close-paren { # setup: gs = "(b)" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 5 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 5 var g/eax: code-point-utf8 <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true - check-screen-row screen, 2/y, "(b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren" - check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren: cursor" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren: matching paren" + check-screen-row screen, 2/y, "(b) ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren" + check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren: cursor" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ) ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren: matching paren" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2 { +fn test-render-grapheme-stack-while-highlighting-matching-close-paren-2 { # setup: gs = "(a (b)) c" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 0x10 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 0x10 var g/eax: code-point-utf8 <- copy 0x63/c - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x20/space - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x20/space - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x61/a - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true - check-screen-row screen, 2/y, "(a (b)) c ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2" - check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2: cursor" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2: matching paren" + check-screen-row screen, 2/y, "(a (b)) c ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2" + check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "| ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2: cursor" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ) ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2: matching paren" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end { +fn test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end { # setup: gs = "(b)" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 5 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 5 var g/eax: code-point-utf8 <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 1/open-paren-depth - check-screen-row screen, 2/y, "(b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, "( ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end: matching paren" + check-screen-row screen, 2/y, "(b) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, "( ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end: matching paren" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2 { +fn test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2 { # setup: gs = "a((b))" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 0x10 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 0x10 var g/eax: code-point-utf8 <- copy 0x61/a - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 1/open-paren-depth - check-screen-row screen, 2/y, "a((b)) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ( ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2: matching paren" + check-screen-row screen, 2/y, "a((b)) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ( ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2: matching paren" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren { +fn test-render-grapheme-stack-while-highlighting-matching-open-paren { # setup: gs = "(b" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 5 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 5 var g/eax: code-point-utf8 <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 0/open-paren-depth - check-screen-row screen, 2/y, "(b ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, "( ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren: matching paren" + check-screen-row screen, 2/y, "(b ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, "( ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren: matching paren" } -fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2 { +fn test-render-grapheme-stack-while-highlighting-matching-open-paren-2 { # setup: gs = "a((b)" - var gs-storage: code-point-utf8-stack - var gs/edi: (addr code-point-utf8-stack) <- address gs-storage - initialize-code-point-utf8-stack gs, 0x10 + var gs-storage: grapheme-stack + var gs/edi: (addr grapheme-stack) <- address gs-storage + initialize-grapheme-stack gs, 0x10 var g/eax: code-point-utf8 <- copy 0x61/a - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x28/open-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x62/b - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g g <- copy 0x29/close-paren - push-code-point-utf8-stack gs, g + push-grapheme-stack gs, g # setup: screen var screen-storage: screen var screen/esi: (addr screen) <- address screen-storage initialize-screen screen, 5, 4, 0/no-pixel-graphics # var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 0/open-paren-depth - check-screen-row screen, 2/y, "a((b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2" - check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ( ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2: matching paren" + check-screen-row screen, 2/y, "a((b) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-2" + check-screen-row-in-color screen, 0xf/fg=white, 2/y, " ( ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-2: matching paren" } # return the index of the matching close-paren of the code-point-utf8 at cursor (top of stack) # or top index if there's no matching close-paren -fn get-matching-close-paren-index _self: (addr code-point-utf8-stack), render-cursor?: boolean -> _/edx: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn get-matching-close-paren-index _self: (addr grapheme-stack), render-cursor?: boolean -> _/edx: int { + var self/esi: (addr grapheme-stack) <- copy _self var top-addr/edx: (addr int) <- get self, top # if not rendering cursor, return compare render-cursor?, 0/false @@ -446,8 +446,8 @@ fn get-matching-close-paren-index _self: (addr code-point-utf8-stack), render-cu # return the index of the first open-paren at the given depth # or top index if there's no matching close-paren -fn get-matching-open-paren-index _self: (addr code-point-utf8-stack), control: boolean, depth: int -> _/edx: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn get-matching-open-paren-index _self: (addr grapheme-stack), control: boolean, depth: int -> _/edx: int { + var self/esi: (addr grapheme-stack) <- copy _self var top-addr/edx: (addr int) <- get self, top # if not rendering cursor, return compare control, 0/false @@ -494,8 +494,8 @@ fn get-matching-open-paren-index _self: (addr code-point-utf8-stack), control: b # compare from bottom # beware: modifies 'stream', which must be disposed of after a false result -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 +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 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 @@ -522,8 +522,8 @@ fn prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _ # compare from bottom # beware: modifies 'stream', which must be disposed of after a false result -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 +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 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 @@ -549,15 +549,15 @@ fn suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _ return 1 # true } -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 +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 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 - $code-point-utf8-stack-is-integer?:loop: { + $grapheme-stack-is-integer?:loop: { compare i, *top-addr break-if->= var g/edx: (addr code-point-utf8) <- index data, i diff --git a/514gap-buffer.mu b/514gap-buffer.mu index 6513983c..4765621e 100644 --- a/514gap-buffer.mu +++ b/514gap-buffer.mu @@ -1,8 +1,8 @@ # primitive for editing text type gap-buffer { - left: code-point-utf8-stack - right: code-point-utf8-stack + left: grapheme-stack + right: grapheme-stack # some fields for scanning incrementally through a gap-buffer left-read-index: int right-read-index: int @@ -10,39 +10,39 @@ type gap-buffer { fn initialize-gap-buffer _self: (addr gap-buffer), capacity: int { var self/esi: (addr gap-buffer) <- copy _self - var left/eax: (addr code-point-utf8-stack) <- get self, left - initialize-code-point-utf8-stack left, capacity - var right/eax: (addr code-point-utf8-stack) <- get self, right - initialize-code-point-utf8-stack right, capacity + var left/eax: (addr grapheme-stack) <- get self, left + initialize-grapheme-stack left, capacity + var right/eax: (addr grapheme-stack) <- get self, right + initialize-grapheme-stack right, capacity } fn clear-gap-buffer _self: (addr gap-buffer) { var self/esi: (addr gap-buffer) <- copy _self - var left/eax: (addr code-point-utf8-stack) <- get self, left - clear-code-point-utf8-stack left - var right/eax: (addr code-point-utf8-stack) <- get self, right - clear-code-point-utf8-stack right + var left/eax: (addr grapheme-stack) <- get self, left + clear-grapheme-stack left + var right/eax: (addr grapheme-stack) <- get self, right + clear-grapheme-stack right } fn gap-buffer-empty? _self: (addr gap-buffer) -> _/eax: boolean { var self/esi: (addr gap-buffer) <- copy _self # if !empty?(left) return false { - var left/eax: (addr code-point-utf8-stack) <- get self, left - var result/eax: boolean <- code-point-utf8-stack-empty? left + var left/eax: (addr grapheme-stack) <- get self, left + var result/eax: boolean <- grapheme-stack-empty? left compare result, 0/false break-if-!= return 0/false } # return empty?(right) - var left/eax: (addr code-point-utf8-stack) <- get self, left - var result/eax: boolean <- code-point-utf8-stack-empty? left + var left/eax: (addr grapheme-stack) <- get self, left + var result/eax: boolean <- grapheme-stack-empty? left return result } fn gap-buffer-capacity _gap: (addr gap-buffer) -> _/edx: int { var gap/esi: (addr gap-buffer) <- copy _gap - var left/eax: (addr code-point-utf8-stack) <- get gap, left + var left/eax: (addr grapheme-stack) <- get gap, left var left-data-ah/eax: (addr handle array code-point-utf8) <- get left, data var left-data/eax: (addr array code-point-utf8) <- lookup *left-data-ah var result/eax: int <- length left-data @@ -86,15 +86,15 @@ fn emit-gap-buffer self: (addr gap-buffer), out: (addr stream byte) { fn append-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) { var self/esi: (addr gap-buffer) <- copy _self - var left/eax: (addr code-point-utf8-stack) <- get self, left + var left/eax: (addr grapheme-stack) <- get self, left emit-stack-from-bottom left, out - var right/eax: (addr code-point-utf8-stack) <- get self, right + var right/eax: (addr grapheme-stack) <- get self, right emit-stack-from-top right, out } # dump stack from bottom to top -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 +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 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 @@ -111,8 +111,8 @@ fn emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream } # dump stack from top to bottom -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 +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 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 @@ -139,10 +139,10 @@ fn word-at-gap _self: (addr gap-buffer), out: (addr stream byte) { break-if-!= return } - var left/ecx: (addr code-point-utf8-stack) <- get self, left + var left/ecx: (addr grapheme-stack) <- get self, left var left-index/eax: int <- top-most-word left emit-stack-from-index left, left-index, out - var right/ecx: (addr code-point-utf8-stack) <- get self, right + var right/ecx: (addr grapheme-stack) <- get self, right var right-index/eax: int <- top-most-word right emit-stack-to-index right, right-index, out } @@ -243,7 +243,7 @@ fn test-word-at-gap-multiple-words-with-gap-at-final-non-word { fn code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 { # send top of right most of the time var self/esi: (addr gap-buffer) <- copy _self - var right/edi: (addr code-point-utf8-stack) <- get self, right + var right/edi: (addr grapheme-stack) <- get self, right 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-addr/ecx: (addr int) <- get right, top @@ -256,7 +256,7 @@ fn code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 { return *result } # send top of left only if right is empty - var left/edi: (addr code-point-utf8-stack) <- get self, left + var left/edi: (addr grapheme-stack) <- get self, left 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 top-addr/ecx: (addr int) <- get left, top @@ -272,8 +272,8 @@ fn code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 { return 0 } -fn top-most-word _self: (addr code-point-utf8-stack) -> _/eax: int { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn top-most-word _self: (addr grapheme-stack) -> _/eax: int { + var self/esi: (addr grapheme-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 @@ -294,8 +294,8 @@ fn top-most-word _self: (addr code-point-utf8-stack) -> _/eax: int { return i } -fn emit-stack-from-index _self: (addr code-point-utf8-stack), start: int, out: (addr stream byte) { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn emit-stack-from-index _self: (addr grapheme-stack), start: int, out: (addr stream byte) { + var self/esi: (addr grapheme-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 @@ -311,8 +311,8 @@ fn emit-stack-from-index _self: (addr code-point-utf8-stack), start: int, out: ( } } -fn emit-stack-to-index _self: (addr code-point-utf8-stack), end: int, out: (addr stream byte) { - var self/esi: (addr code-point-utf8-stack) <- copy _self +fn emit-stack-to-index _self: (addr grapheme-stack), end: int, out: (addr stream byte) { + var self/esi: (addr grapheme-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 @@ -384,14 +384,14 @@ fn is-ascii-word-code-point-utf8? g: code-point-utf8 -> _/eax: boolean { # cursor is a single other color. fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int { var gap/esi: (addr gap-buffer) <- copy _gap - var left/edx: (addr code-point-utf8-stack) <- get gap, left + var left/edx: (addr grapheme-stack) <- get gap, left var highlight-matching-open-paren?/ebx: boolean <- copy 0/false var matching-open-paren-depth/edi: int <- copy 0 highlight-matching-open-paren?, matching-open-paren-depth <- highlight-matching-open-paren? gap, render-cursor? var x2/eax: int <- copy 0 var y2/ecx: int <- copy 0 x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, left, xmin, ymin, xmax, ymax, xmin, ymin, highlight-matching-open-paren?, matching-open-paren-depth, color, background-color - var right/edx: (addr code-point-utf8-stack) <- get gap, right + var right/edx: (addr grapheme-stack) <- get gap, right x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, right, xmin, ymin, xmax, ymax, x2, y2, render-cursor?, color, background-color # decide whether we still need to print a cursor var fg/edi: int <- copy color @@ -400,7 +400,7 @@ fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr { break-if-= # if the right side is empty, code-point-utf8 stack didn't print the cursor - var empty?/eax: boolean <- code-point-utf8-stack-empty? right + var empty?/eax: boolean <- grapheme-stack-empty? right compare empty?, 0/false break-if-= # swap foreground and background @@ -427,10 +427,10 @@ fn render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: i fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int { var gap/esi: (addr gap-buffer) <- copy _gap - var left/eax: (addr code-point-utf8-stack) <- get gap, left + var left/eax: (addr grapheme-stack) <- get gap, left var tmp/eax: (addr int) <- get left, top var left-length/ecx: int <- copy *tmp - var right/esi: (addr code-point-utf8-stack) <- get gap, right + var right/esi: (addr grapheme-stack) <- get gap, right tmp <- get right, top var result/eax: int <- copy *tmp result <- add left-length @@ -439,8 +439,8 @@ fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int { 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 code-point-utf8-stack) <- get self, left - push-code-point-utf8-stack left, g + var left/eax: (addr grapheme-stack) <- get self, left + push-grapheme-stack left, g } fn add-code-point-at-gap self: (addr gap-buffer), c: code-point { @@ -466,28 +466,28 @@ 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 code-point-utf8-stack) <- get self, left - var result/eax: boolean <- code-point-utf8-stack-empty? left + var left/eax: (addr grapheme-stack) <- get self, left + var result/eax: boolean <- grapheme-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 code-point-utf8-stack) <- get self, right - var result/eax: boolean <- code-point-utf8-stack-empty? right + var right/eax: (addr grapheme-stack) <- get self, right + var result/eax: boolean <- grapheme-stack-empty? right return result } fn gap-right _self: (addr gap-buffer) -> _/eax: code-point-utf8 { var self/esi: (addr gap-buffer) <- copy _self 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 + var right/ecx: (addr grapheme-stack) <- get self, right + g <- pop-grapheme-stack right compare g, -1 { break-if-= - var left/ecx: (addr code-point-utf8-stack) <- get self, left - push-code-point-utf8-stack left, g + var left/ecx: (addr grapheme-stack) <- get self, left + push-grapheme-stack left, g } return g } @@ -496,21 +496,21 @@ fn gap-left _self: (addr gap-buffer) -> _/eax: code-point-utf8 { var self/esi: (addr gap-buffer) <- copy _self var g/eax: code-point-utf8 <- copy 0 { - var left/ecx: (addr code-point-utf8-stack) <- get self, left - g <- pop-code-point-utf8-stack left + var left/ecx: (addr grapheme-stack) <- get self, left + g <- pop-grapheme-stack left } compare g, -1 { break-if-= - var right/ecx: (addr code-point-utf8-stack) <- get self, right - push-code-point-utf8-stack right, g + var right/ecx: (addr grapheme-stack) <- get self, right + push-grapheme-stack right, g } return g } fn index-of-gap _self: (addr gap-buffer) -> _/eax: int { var self/eax: (addr gap-buffer) <- copy _self - var left/eax: (addr code-point-utf8-stack) <- get self, left + var left/eax: (addr grapheme-stack) <- get self, left var top-addr/eax: (addr int) <- get left, top var result/eax: int <- copy *top-addr return result @@ -519,7 +519,7 @@ fn index-of-gap _self: (addr gap-buffer) -> _/eax: int { 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 code-point-utf8-stack) <- get self, left + var left/eax: (addr grapheme-stack) <- get self, left var top-addr/ecx: (addr int) <- get left, top compare *top-addr, 0 { @@ -530,7 +530,7 @@ fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-p return *result-addr } # try to read from right - var right/eax: (addr code-point-utf8-stack) <- get self, right + var right/eax: (addr grapheme-stack) <- get self, right top-addr <- get right, top compare *top-addr, 0 { @@ -549,13 +549,13 @@ fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-p 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 code-point-utf8-stack) <- get self, left + var left/ecx: (addr grapheme-stack) <- get self, left var top-addr/edx: (addr int) <- get left, top compare *top-addr, 0 { break-if-<= - var result/eax: code-point-utf8 <- pop-code-point-utf8-stack left - push-code-point-utf8-stack left, result + var result/eax: code-point-utf8 <- pop-grapheme-stack left + push-grapheme-stack left, result return result } # give up @@ -564,14 +564,14 @@ fn code-point-utf8-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax fn delete-before-gap _self: (addr gap-buffer) { var self/eax: (addr gap-buffer) <- copy _self - var left/eax: (addr code-point-utf8-stack) <- get self, left - var dummy/eax: code-point-utf8 <- pop-code-point-utf8-stack left + var left/eax: (addr grapheme-stack) <- get self, left + var dummy/eax: code-point-utf8 <- pop-grapheme-stack left } fn pop-after-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 { var self/eax: (addr gap-buffer) <- copy _self - var right/eax: (addr code-point-utf8-stack) <- get self, right - var result/eax: code-point-utf8 <- pop-code-point-utf8-stack right + var right/eax: (addr grapheme-stack) <- get self, right + var result/eax: code-point-utf8 <- pop-grapheme-stack right return result } @@ -584,7 +584,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo var expected-stream/ecx: (addr stream byte) <- address stream-storage write expected-stream, s # compare left - var left/edx: (addr code-point-utf8-stack) <- get self, left + var left/edx: (addr grapheme-stack) <- get self, left var result/eax: boolean <- prefix-match? left, expected-stream compare result, 0/false { @@ -592,7 +592,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo return result } # compare right - var right/edx: (addr code-point-utf8-stack) <- get self, right + var right/edx: (addr grapheme-stack) <- get self, right result <- suffix-match? right, expected-stream compare result, 0/false { @@ -691,7 +691,7 @@ fn gap-index _self: (addr gap-buffer), _n: int -> _/eax: code-point-utf8 { var self/esi: (addr gap-buffer) <- copy _self var n/ebx: int <- copy _n # if n < left->length, index into left - var left/edi: (addr code-point-utf8-stack) <- get self, left + var left/edi: (addr grapheme-stack) <- get self, left var left-len-a/edx: (addr int) <- get left, top compare n, *left-len-a { @@ -704,7 +704,7 @@ fn gap-index _self: (addr gap-buffer), _n: int -> _/eax: code-point-utf8 { # shrink n n <- subtract *left-len-a # if n < right->length, index into right - var right/edi: (addr code-point-utf8-stack) <- get self, right + var right/edi: (addr grapheme-stack) <- get self, right var right-len-a/edx: (addr int) <- get right, top compare n, *right-len-a { @@ -788,25 +788,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 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 + # 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 src <- get src-a, right dest <- get dest-a, right - copy-code-point-utf8-stack src, dest + copy-grapheme-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 code-point-utf8-stack) <- get self, left - var result/eax: boolean <- code-point-utf8-stack-is-decimal-integer? curr + var curr/ecx: (addr grapheme-stack) <- get self, left + var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr { compare result, 0/false break-if-= curr <- get self, right - result <- code-point-utf8-stack-is-decimal-integer? curr + result <- grapheme-stack-is-decimal-integer? curr } return result } @@ -947,7 +947,7 @@ fn highlight-matching-open-paren? _gap: (addr gap-buffer), render-cursor?: boole return 0/false, 0 } var gap/esi: (addr gap-buffer) <- copy _gap - var stack/edi: (addr code-point-utf8-stack) <- get gap, right + var stack/edi: (addr grapheme-stack) <- get gap, right var top-addr/eax: (addr int) <- get stack, top var top-index/ecx: int <- copy *top-addr compare top-index, 0 @@ -1022,8 +1022,8 @@ fn rewind-gap-buffer _self: (addr gap-buffer) { fn gap-buffer-scan-done? _self: (addr gap-buffer) -> _/eax: boolean { var self/esi: (addr gap-buffer) <- copy _self # more in left? - var left/eax: (addr code-point-utf8-stack) <- get self, left - var left-size/eax: int <- code-point-utf8-stack-length left + var left/eax: (addr grapheme-stack) <- get self, left + var left-size/eax: int <- grapheme-stack-length left var left-read-index/ecx: (addr int) <- get self, left-read-index compare *left-read-index, left-size { @@ -1031,8 +1031,8 @@ fn gap-buffer-scan-done? _self: (addr gap-buffer) -> _/eax: boolean { return 0/false } # more in right? - var right/eax: (addr code-point-utf8-stack) <- get self, right - var right-size/eax: int <- code-point-utf8-stack-length right + var right/eax: (addr grapheme-stack) <- get self, right + var right-size/eax: int <- grapheme-stack-length right var right-read-index/ecx: (addr int) <- get self, right-read-index compare *right-read-index, right-size { @@ -1046,8 +1046,8 @@ fn gap-buffer-scan-done? _self: (addr gap-buffer) -> _/eax: boolean { fn peek-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { var self/esi: (addr gap-buffer) <- copy _self # more in left? - var left/ecx: (addr code-point-utf8-stack) <- get self, left - var left-size/eax: int <- code-point-utf8-stack-length left + var left/ecx: (addr grapheme-stack) <- get self, left + var left-size/eax: int <- grapheme-stack-length left var left-read-index-a/edx: (addr int) <- get self, left-read-index compare *left-read-index-a, left-size { @@ -1059,8 +1059,8 @@ fn peek-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { return *result } # more in right? - var right/ecx: (addr code-point-utf8-stack) <- get self, right - var _right-size/eax: int <- code-point-utf8-stack-length right + var right/ecx: (addr grapheme-stack) <- get self, right + var _right-size/eax: int <- grapheme-stack-length right var right-size/ebx: int <- copy _right-size var right-read-index-a/edx: (addr int) <- get self, right-read-index compare *right-read-index-a, right-size @@ -1082,8 +1082,8 @@ fn peek-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { fn read-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { var self/esi: (addr gap-buffer) <- copy _self # more in left? - var left/ecx: (addr code-point-utf8-stack) <- get self, left - var left-size/eax: int <- code-point-utf8-stack-length left + var left/ecx: (addr grapheme-stack) <- get self, left + var left-size/eax: int <- grapheme-stack-length left var left-read-index-a/edx: (addr int) <- get self, left-read-index compare *left-read-index-a, left-size { @@ -1096,8 +1096,8 @@ fn read-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { return *result } # more in right? - var right/ecx: (addr code-point-utf8-stack) <- get self, right - var _right-size/eax: int <- code-point-utf8-stack-length right + var right/ecx: (addr grapheme-stack) <- get self, right + var _right-size/eax: int <- grapheme-stack-length right var right-size/ebx: int <- copy _right-size var right-read-index-a/edx: (addr int) <- get self, right-read-index compare *right-read-index-a, right-size @@ -1120,8 +1120,8 @@ fn read-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 { fn put-back-from-gap-buffer _self: (addr gap-buffer) { var self/esi: (addr gap-buffer) <- copy _self # more in right? - var right/eax: (addr code-point-utf8-stack) <- get self, right - var right-size/eax: int <- code-point-utf8-stack-length right + var right/eax: (addr grapheme-stack) <- get self, right + var right-size/eax: int <- grapheme-stack-length right var right-read-index-a/eax: (addr int) <- get self, right-read-index compare *right-read-index-a, 0 { @@ -1130,8 +1130,8 @@ fn put-back-from-gap-buffer _self: (addr gap-buffer) { return } # more in left? - var left/eax: (addr code-point-utf8-stack) <- get self, left - var left-size/eax: int <- code-point-utf8-stack-length left + var left/eax: (addr grapheme-stack) <- get self, left + var left-size/eax: int <- grapheme-stack-length left var left-read-index-a/eax: (addr int) <- get self, left-read-index decrement *left-read-index-a } diff --git a/html/513grapheme-stack.mu.html b/html/513grapheme-stack.mu.html index bde73e65..8476f08d 100644 --- a/html/513grapheme-stack.mu.html +++ b/html/513grapheme-stack.mu.html @@ -64,27 +64,27 @@ if ('onhashchange' in window) {
   1 # code-point-utf8 stacks are the smallest unit of editable text
   2 
-  3 type code-point-utf8-stack {
+  3 type grapheme-stack {
   4   data: (handle array code-point-utf8)
   5   top: int
   6 }
   7 
-  8 fn initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int {
-  9   var self/esi: (addr code-point-utf8-stack) <- copy _self
+  8 fn initialize-grapheme-stack _self: (addr grapheme-stack), n: int {
+  9   var self/esi: (addr grapheme-stack) <- copy _self
  10   var d/edi: (addr handle array code-point-utf8) <- get self, data
  11   populate d, n
  12   var top/eax: (addr int) <- get self, top
  13   copy-to *top, 0
  14 }
  15 
- 16 fn clear-code-point-utf8-stack _self: (addr code-point-utf8-stack) {
- 17   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 16 fn clear-grapheme-stack _self: (addr grapheme-stack) {
+ 17   var self/esi: (addr grapheme-stack) <- copy _self
  18   var top/eax: (addr int) <- get self, top
  19   copy-to *top, 0
  20 }
  21 
- 22 fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
- 23   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 22 fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
+ 23   var self/esi: (addr grapheme-stack) <- copy _self
  24   var top/eax: (addr int) <- get self, top
  25   compare *top, 0
  26   {
@@ -94,14 +94,14 @@ if ('onhashchange' in window) {
  30   return 0/false
  31 }
  32 
- 33 fn code-point-utf8-stack-length _self: (addr code-point-utf8-stack) -> _/eax: int {
- 34   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 33 fn grapheme-stack-length _self: (addr grapheme-stack) -> _/eax: int {
+ 34   var self/esi: (addr grapheme-stack) <- copy _self
  35   var top/eax: (addr int) <- get self, top
  36   return *top
  37 }
  38 
- 39 fn push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-point-utf8 {
- 40   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 39 fn push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8 {
+ 40   var self/esi: (addr grapheme-stack) <- copy _self
  41   var top-addr/ecx: (addr int) <- get self, top
  42   var data-ah/edx: (addr handle array code-point-utf8) <- get self, data
  43   var data/eax: (addr array code-point-utf8) <- lookup *data-ah
@@ -112,8 +112,8 @@ if ('onhashchange' in window) {
  48   add-to *top-addr, 1
  49 }
  50 
- 51 fn pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-point-utf8 {
- 52   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 51 fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8 {
+ 52   var self/esi: (addr grapheme-stack) <- copy _self
  53   var top-addr/ecx: (addr int) <- get self, top
  54   {
  55     compare *top-addr, 0
@@ -128,8 +128,8 @@ if ('onhashchange' in window) {
  64   return *result-addr
  65 }
  66 
- 67 fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr code-point-utf8-stack) {
- 68   var src/esi: (addr code-point-utf8-stack) <- copy _src
+ 67 fn copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack) {
+ 68   var src/esi: (addr grapheme-stack) <- copy _src
  69   var data-ah/edi: (addr handle array code-point-utf8) <- get src, data
  70   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  71   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -139,7 +139,7 @@ if ('onhashchange' in window) {
  75     compare i, *top-addr
  76     break-if->=
  77     var g/edx: (addr code-point-utf8) <- index data, i
- 78     push-code-point-utf8-stack dest, *g
+ 78     push-grapheme-stack dest, *g
  79     i <- increment
  80     loop
  81   }
@@ -148,8 +148,8 @@ if ('onhashchange' in window) {
  84 # dump stack to screen from bottom to top
  85 # hardcoded colors:
  86 #   matching paren
- 87 fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int {
- 88   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 87 fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int {
+ 88   var self/esi: (addr grapheme-stack) <- copy _self
  89   var matching-open-paren-index/edx: int <- get-matching-open-paren-index self, highlight-matching-open-paren?, open-paren-depth
  90   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  91   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
@@ -187,7 +187,7 @@ if ('onhashchange' in window) {
 123 }
 124 
 125 # helper for small words
-126 fn render-stack-from-bottom screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int {
+126 fn render-stack-from-bottom screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int {
 127   var _width/eax: int <- copy 0
 128   var _height/ecx: int <- copy 0
 129   _width, _height <- screen-size screen
@@ -204,8 +204,8 @@ if ('onhashchange' in window) {
 140 # hard-coded colors:
 141 #   matching paren
 142 #   cursor
-143 fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int {
-144   var self/esi: (addr code-point-utf8-stack) <- copy _self
+143 fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int {
+144   var self/esi: (addr grapheme-stack) <- copy _self
 145   var matching-close-paren-index/edx: int <- get-matching-close-paren-index self, render-cursor?
 146   var data-ah/eax: (addr handle array code-point-utf8) <- get self, data
 147   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
@@ -260,7 +260,7 @@ if ('onhashchange' in window) {
 196 }
 197 
 198 # helper for small words
-199 fn render-stack-from-top screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int {
+199 fn render-stack-from-top screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int {
 200   var _width/eax: int <- copy 0
 201   var _height/ecx: int <- copy 0
 202   _width, _height <- screen-size screen
@@ -272,190 +272,190 @@ if ('onhashchange' in window) {
 208   return x2  # y2? yolo
 209 }
 210 
-211 fn test-render-code-point-utf8-stack {
+211 fn test-render-grapheme-stack {
 212   # setup: gs = "abc"
-213   var gs-storage: code-point-utf8-stack
-214   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-215   initialize-code-point-utf8-stack gs, 5
+213   var gs-storage: grapheme-stack
+214   var gs/edi: (addr grapheme-stack) <- address gs-storage
+215   initialize-grapheme-stack gs, 5
 216   var g/eax: code-point-utf8 <- copy 0x61/a
-217   push-code-point-utf8-stack gs, g
+217   push-grapheme-stack gs, g
 218   g <- copy 0x62/b
-219   push-code-point-utf8-stack gs, g
+219   push-grapheme-stack gs, g
 220   g <- copy 0x63/c
-221   push-code-point-utf8-stack gs, g
+221   push-grapheme-stack gs, g
 222   # setup: screen
 223   var screen-storage: screen
 224   var screen/esi: (addr screen) <- address screen-storage
 225   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 226   #
 227   var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 0/y, 0/no-highlight-matching-open-paren, 0/open-paren-depth
-228   check-screen-row screen, 0/y, "abc ", "F - test-render-code-point-utf8-stack from bottom"
-229   check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from bottom: result"
-230   check-background-color-in-screen-row screen, 3/bg=reverse, 0/y, "   ", "F - test-render-code-point-utf8-stack from bottom: bg"
+228   check-screen-row screen, 0/y, "abc ", "F - test-render-grapheme-stack from bottom"
+229   check-ints-equal x, 3, "F - test-render-grapheme-stack from bottom: result"
+230   check-background-color-in-screen-row screen, 3/bg=reverse, 0/y, "   ", "F - test-render-grapheme-stack from bottom: bg"
 231   #
 232   var x/eax: int <- render-stack-from-top screen, gs, 0/x, 1/y, 0/cursor=false
-233   check-screen-row screen, 1/y, "cba ", "F - test-render-code-point-utf8-stack from top without cursor"
-234   check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from top without cursor: result"
-235   check-background-color-in-screen-row screen, 3/bg=reverse, 1/y, "   ", "F - test-render-code-point-utf8-stack from top without cursor: bg"
+233   check-screen-row screen, 1/y, "cba ", "F - test-render-grapheme-stack from top without cursor"
+234   check-ints-equal x, 3, "F - test-render-grapheme-stack from top without cursor: result"
+235   check-background-color-in-screen-row screen, 3/bg=reverse, 1/y, "   ", "F - test-render-grapheme-stack from top without cursor: bg"
 236   #
 237   var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true
-238   check-screen-row screen, 2/y, "cba ", "F - test-render-code-point-utf8-stack from top with cursor"
-239   check-ints-equal x, 3, "F - test-render-code-point-utf8-stack from top with cursor: result"
-240   check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "|   ", "F - test-render-code-point-utf8-stack from top with cursor: bg"
+238   check-screen-row screen, 2/y, "cba ", "F - test-render-grapheme-stack from top with cursor"
+239   check-ints-equal x, 3, "F - test-render-grapheme-stack from top with cursor: result"
+240   check-background-color-in-screen-row screen, 3/bg=reverse, 2/y, "|   ", "F - test-render-grapheme-stack from top with cursor: bg"
 241 }
 242 
-243 fn test-render-code-point-utf8-stack-while-highlighting-matching-close-paren {
+243 fn test-render-grapheme-stack-while-highlighting-matching-close-paren {
 244   # setup: gs = "(b)"
-245   var gs-storage: code-point-utf8-stack
-246   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-247   initialize-code-point-utf8-stack gs, 5
+245   var gs-storage: grapheme-stack
+246   var gs/edi: (addr grapheme-stack) <- address gs-storage
+247   initialize-grapheme-stack gs, 5
 248   var g/eax: code-point-utf8 <- copy 0x29/close-paren
-249   push-code-point-utf8-stack gs, g
+249   push-grapheme-stack gs, g
 250   g <- copy 0x62/b
-251   push-code-point-utf8-stack gs, g
+251   push-grapheme-stack gs, g
 252   g <- copy 0x28/open-paren
-253   push-code-point-utf8-stack gs, g
+253   push-grapheme-stack gs, g
 254   # setup: screen
 255   var screen-storage: screen
 256   var screen/esi: (addr screen) <- address screen-storage
 257   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 258   #
 259   var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true
-260   check-screen-row                      screen,               2/y, "(b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren"
-261   check-background-color-in-screen-row  screen, 3/bg=reverse,  2/y, "|   ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren: cursor"
-262   check-screen-row-in-color             screen, 0xf/fg=white, 2/y, "  ) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren: matching paren"
+260   check-screen-row                      screen,               2/y, "(b) ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren"
+261   check-background-color-in-screen-row  screen, 3/bg=reverse,  2/y, "|   ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren: cursor"
+262   check-screen-row-in-color             screen, 0xf/fg=white, 2/y, "  ) ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren: matching paren"
 263 }
 264 
-265 fn test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2 {
+265 fn test-render-grapheme-stack-while-highlighting-matching-close-paren-2 {
 266   # setup: gs = "(a (b)) c"
-267   var gs-storage: code-point-utf8-stack
-268   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-269   initialize-code-point-utf8-stack gs, 0x10
+267   var gs-storage: grapheme-stack
+268   var gs/edi: (addr grapheme-stack) <- address gs-storage
+269   initialize-grapheme-stack gs, 0x10
 270   var g/eax: code-point-utf8 <- copy 0x63/c
-271   push-code-point-utf8-stack gs, g
+271   push-grapheme-stack gs, g
 272   g <- copy 0x20/space
-273   push-code-point-utf8-stack gs, g
+273   push-grapheme-stack gs, g
 274   g <- copy 0x29/close-paren
-275   push-code-point-utf8-stack gs, g
+275   push-grapheme-stack gs, g
 276   g <- copy 0x29/close-paren
-277   push-code-point-utf8-stack gs, g
+277   push-grapheme-stack gs, g
 278   g <- copy 0x62/b
-279   push-code-point-utf8-stack gs, g
+279   push-grapheme-stack gs, g
 280   g <- copy 0x28/open-paren
-281   push-code-point-utf8-stack gs, g
+281   push-grapheme-stack gs, g
 282   g <- copy 0x20/space
-283   push-code-point-utf8-stack gs, g
+283   push-grapheme-stack gs, g
 284   g <- copy 0x61/a
-285   push-code-point-utf8-stack gs, g
+285   push-grapheme-stack gs, g
 286   g <- copy 0x28/open-paren
-287   push-code-point-utf8-stack gs, g
+287   push-grapheme-stack gs, g
 288   # setup: screen
 289   var screen-storage: screen
 290   var screen/esi: (addr screen) <- address screen-storage
 291   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 292   #
 293   var x/eax: int <- render-stack-from-top screen, gs, 0/x, 2/y, 1/cursor=true
-294   check-screen-row                      screen,               2/y, "(a (b)) c ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2"
-295   check-background-color-in-screen-row  screen, 3/bg=reverse,  2/y, "|         ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2: cursor"
-296   check-screen-row-in-color             screen, 0xf/fg=white, 2/y, "      )   ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-close-paren-2: matching paren"
+294   check-screen-row                      screen,               2/y, "(a (b)) c ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2"
+295   check-background-color-in-screen-row  screen, 3/bg=reverse,  2/y, "|         ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2: cursor"
+296   check-screen-row-in-color             screen, 0xf/fg=white, 2/y, "      )   ", "F - test-render-grapheme-stack-while-highlighting-matching-close-paren-2: matching paren"
 297 }
 298 
-299 fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end {
+299 fn test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end {
 300   # setup: gs = "(b)"
-301   var gs-storage: code-point-utf8-stack
-302   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-303   initialize-code-point-utf8-stack gs, 5
+301   var gs-storage: grapheme-stack
+302   var gs/edi: (addr grapheme-stack) <- address gs-storage
+303   initialize-grapheme-stack gs, 5
 304   var g/eax: code-point-utf8 <- copy 0x28/open-paren
-305   push-code-point-utf8-stack gs, g
+305   push-grapheme-stack gs, g
 306   g <- copy 0x62/b
-307   push-code-point-utf8-stack gs, g
+307   push-grapheme-stack gs, g
 308   g <- copy 0x29/close-paren
-309   push-code-point-utf8-stack gs, g
+309   push-grapheme-stack gs, g
 310   # setup: screen
 311   var screen-storage: screen
 312   var screen/esi: (addr screen) <- address screen-storage
 313   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 314   #
 315   var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 1/open-paren-depth
-316   check-screen-row          screen,               2/y, "(b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end"
-317   check-screen-row-in-color screen, 0xf/fg=white, 2/y, "(   ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end: matching paren"
+316   check-screen-row          screen,               2/y, "(b) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end"
+317   check-screen-row-in-color screen, 0xf/fg=white, 2/y, "(   ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end: matching paren"
 318 }
 319 
-320 fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2 {
+320 fn test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2 {
 321   # setup: gs = "a((b))"
-322   var gs-storage: code-point-utf8-stack
-323   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-324   initialize-code-point-utf8-stack gs, 0x10
+322   var gs-storage: grapheme-stack
+323   var gs/edi: (addr grapheme-stack) <- address gs-storage
+324   initialize-grapheme-stack gs, 0x10
 325   var g/eax: code-point-utf8 <- copy 0x61/a
-326   push-code-point-utf8-stack gs, g
+326   push-grapheme-stack gs, g
 327   g <- copy 0x28/open-paren
-328   push-code-point-utf8-stack gs, g
+328   push-grapheme-stack gs, g
 329   g <- copy 0x28/open-paren
-330   push-code-point-utf8-stack gs, g
+330   push-grapheme-stack gs, g
 331   g <- copy 0x62/b
-332   push-code-point-utf8-stack gs, g
+332   push-grapheme-stack gs, g
 333   g <- copy 0x29/close-paren
-334   push-code-point-utf8-stack gs, g
+334   push-grapheme-stack gs, g
 335   g <- copy 0x29/close-paren
-336   push-code-point-utf8-stack gs, g
+336   push-grapheme-stack gs, g
 337   # setup: screen
 338   var screen-storage: screen
 339   var screen/esi: (addr screen) <- address screen-storage
 340   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 341   #
 342   var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 1/open-paren-depth
-343   check-screen-row          screen,               2/y, "a((b)) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2"
-344   check-screen-row-in-color screen, 0xf/fg=white, 2/y, " (     ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2: matching paren"
+343   check-screen-row          screen,               2/y, "a((b)) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2"
+344   check-screen-row-in-color screen, 0xf/fg=white, 2/y, " (     ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-with-close-paren-at-end-2: matching paren"
 345 }
 346 
-347 fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren {
+347 fn test-render-grapheme-stack-while-highlighting-matching-open-paren {
 348   # setup: gs = "(b"
-349   var gs-storage: code-point-utf8-stack
-350   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-351   initialize-code-point-utf8-stack gs, 5
+349   var gs-storage: grapheme-stack
+350   var gs/edi: (addr grapheme-stack) <- address gs-storage
+351   initialize-grapheme-stack gs, 5
 352   var g/eax: code-point-utf8 <- copy 0x28/open-paren
-353   push-code-point-utf8-stack gs, g
+353   push-grapheme-stack gs, g
 354   g <- copy 0x62/b
-355   push-code-point-utf8-stack gs, g
+355   push-grapheme-stack gs, g
 356   # setup: screen
 357   var screen-storage: screen
 358   var screen/esi: (addr screen) <- address screen-storage
 359   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 360   #
 361   var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 0/open-paren-depth
-362   check-screen-row          screen,               2/y, "(b ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren"
-363   check-screen-row-in-color screen, 0xf/fg=white, 2/y, "(  ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren: matching paren"
+362   check-screen-row          screen,               2/y, "(b ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren"
+363   check-screen-row-in-color screen, 0xf/fg=white, 2/y, "(  ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren: matching paren"
 364 }
 365 
-366 fn test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2 {
+366 fn test-render-grapheme-stack-while-highlighting-matching-open-paren-2 {
 367   # setup: gs = "a((b)"
-368   var gs-storage: code-point-utf8-stack
-369   var gs/edi: (addr code-point-utf8-stack) <- address gs-storage
-370   initialize-code-point-utf8-stack gs, 0x10
+368   var gs-storage: grapheme-stack
+369   var gs/edi: (addr grapheme-stack) <- address gs-storage
+370   initialize-grapheme-stack gs, 0x10
 371   var g/eax: code-point-utf8 <- copy 0x61/a
-372   push-code-point-utf8-stack gs, g
+372   push-grapheme-stack gs, g
 373   g <- copy 0x28/open-paren
-374   push-code-point-utf8-stack gs, g
+374   push-grapheme-stack gs, g
 375   g <- copy 0x28/open-paren
-376   push-code-point-utf8-stack gs, g
+376   push-grapheme-stack gs, g
 377   g <- copy 0x62/b
-378   push-code-point-utf8-stack gs, g
+378   push-grapheme-stack gs, g
 379   g <- copy 0x29/close-paren
-380   push-code-point-utf8-stack gs, g
+380   push-grapheme-stack gs, g
 381   # setup: screen
 382   var screen-storage: screen
 383   var screen/esi: (addr screen) <- address screen-storage
 384   initialize-screen screen, 5, 4, 0/no-pixel-graphics
 385   #
 386   var x/eax: int <- render-stack-from-bottom screen, gs, 0/x, 2/y, 1/highlight-matching-open-paren, 0/open-paren-depth
-387   check-screen-row          screen,               2/y, "a((b) ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2"
-388   check-screen-row-in-color screen, 0xf/fg=white, 2/y, " (    ", "F - test-render-code-point-utf8-stack-while-highlighting-matching-open-paren-2: matching paren"
+387   check-screen-row          screen,               2/y, "a((b) ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-2"
+388   check-screen-row-in-color screen, 0xf/fg=white, 2/y, " (    ", "F - test-render-grapheme-stack-while-highlighting-matching-open-paren-2: matching paren"
 389 }
 390 
 391 # return the index of the matching close-paren of the code-point-utf8 at cursor (top of stack)
 392 # or top index if there's no matching close-paren
-393 fn get-matching-close-paren-index _self: (addr code-point-utf8-stack), render-cursor?: boolean -> _/edx: int {
-394   var self/esi: (addr code-point-utf8-stack) <- copy _self
+393 fn get-matching-close-paren-index _self: (addr grapheme-stack), render-cursor?: boolean -> _/edx: int {
+394   var self/esi: (addr grapheme-stack) <- copy _self
 395   var top-addr/edx: (addr int) <- get self, top
 396   # if not rendering cursor, return
 397   compare render-cursor?, 0/false
@@ -510,8 +510,8 @@ if ('onhashchange' in window) {
 446 
 447 # return the index of the first open-paren at the given depth
 448 # or top index if there's no matching close-paren
-449 fn get-matching-open-paren-index _self: (addr code-point-utf8-stack), control: boolean, depth: int -> _/edx: int {
-450   var self/esi: (addr code-point-utf8-stack) <- copy _self
+449 fn get-matching-open-paren-index _self: (addr grapheme-stack), control: boolean, depth: int -> _/edx: int {
+450   var self/esi: (addr grapheme-stack) <- copy _self
 451   var top-addr/edx: (addr int) <- get self, top
 452   # if not rendering cursor, return
 453   compare control, 0/false
@@ -558,8 +558,8 @@ if ('onhashchange' in window) {
 494 
 495 # compare from bottom
 496 # beware: modifies 'stream', which must be disposed of after a false result
-497 fn prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
-498   var self/esi: (addr code-point-utf8-stack) <- copy _self
+497 fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
+498   var self/esi: (addr grapheme-stack) <- copy _self
 499   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
 500   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 501   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -586,8 +586,8 @@ if ('onhashchange' in window) {
 522 
 523 # compare from bottom
 524 # beware: modifies 'stream', which must be disposed of after a false result
-525 fn suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
-526   var self/esi: (addr code-point-utf8-stack) <- copy _self
+525 fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
+526   var self/esi: (addr grapheme-stack) <- copy _self
 527   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
 528   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 529   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -613,15 +613,15 @@ if ('onhashchange' in window) {
 549   return 1   # true
 550 }
 551 
-552 fn code-point-utf8-stack-is-decimal-integer? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
-553   var self/esi: (addr code-point-utf8-stack) <- copy _self
+552 fn grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boolean {
+553   var self/esi: (addr grapheme-stack) <- copy _self
 554   var data-ah/eax: (addr handle array code-point-utf8) <- get self, data
 555   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 556   var data/edx: (addr array code-point-utf8) <- copy _data
 557   var top-addr/ecx: (addr int) <- get self, top
 558   var i/ebx: int <- copy 0
 559   var result/eax: boolean <- copy 1/true
-560   $code-point-utf8-stack-is-integer?:loop: {
+560   $grapheme-stack-is-integer?:loop: {
 561     compare i, *top-addr
 562     break-if->=
 563     var g/edx: (addr code-point-utf8) <- index data, i
diff --git a/html/514gap-buffer.mu.html b/html/514gap-buffer.mu.html
index fecdeb83..b93853d1 100644
--- a/html/514gap-buffer.mu.html
+++ b/html/514gap-buffer.mu.html
@@ -65,8 +65,8 @@ if ('onhashchange' in window) {
    1 # primitive for editing text
    2 
    3 type gap-buffer {
-   4   left: code-point-utf8-stack
-   5   right: code-point-utf8-stack
+   4   left: grapheme-stack
+   5   right: grapheme-stack
    6   # some fields for scanning incrementally through a gap-buffer
    7   left-read-index: int
    8   right-read-index: int
@@ -74,39 +74,39 @@ if ('onhashchange' in window) {
   10 
   11 fn initialize-gap-buffer _self: (addr gap-buffer), capacity: int {
   12   var self/esi: (addr gap-buffer) <- copy _self
-  13   var left/eax: (addr code-point-utf8-stack) <- get self, left
-  14   initialize-code-point-utf8-stack left, capacity
-  15   var right/eax: (addr code-point-utf8-stack) <- get self, right
-  16   initialize-code-point-utf8-stack right, capacity
+  13   var left/eax: (addr grapheme-stack) <- get self, left
+  14   initialize-grapheme-stack left, capacity
+  15   var right/eax: (addr grapheme-stack) <- get self, right
+  16   initialize-grapheme-stack right, capacity
   17 }
   18 
   19 fn clear-gap-buffer _self: (addr gap-buffer) {
   20   var self/esi: (addr gap-buffer) <- copy _self
-  21   var left/eax: (addr code-point-utf8-stack) <- get self, left
-  22   clear-code-point-utf8-stack left
-  23   var right/eax: (addr code-point-utf8-stack) <- get self, right
-  24   clear-code-point-utf8-stack right
+  21   var left/eax: (addr grapheme-stack) <- get self, left
+  22   clear-grapheme-stack left
+  23   var right/eax: (addr grapheme-stack) <- get self, right
+  24   clear-grapheme-stack right
   25 }
   26 
   27 fn gap-buffer-empty? _self: (addr gap-buffer) -> _/eax: boolean {
   28   var self/esi: (addr gap-buffer) <- copy _self
   29   # if !empty?(left) return false
   30   {
-  31     var left/eax: (addr code-point-utf8-stack) <- get self, left
-  32     var result/eax: boolean <- code-point-utf8-stack-empty? left
+  31     var left/eax: (addr grapheme-stack) <- get self, left
+  32     var result/eax: boolean <- grapheme-stack-empty? left
   33     compare result, 0/false
   34     break-if-!=
   35     return 0/false
   36   }
   37   # return empty?(right)
-  38   var left/eax: (addr code-point-utf8-stack) <- get self, left
-  39   var result/eax: boolean <- code-point-utf8-stack-empty? left
+  38   var left/eax: (addr grapheme-stack) <- get self, left
+  39   var result/eax: boolean <- grapheme-stack-empty? left
   40   return result
   41 }
   42 
   43 fn gap-buffer-capacity _gap: (addr gap-buffer) -> _/edx: int {
   44   var gap/esi: (addr gap-buffer) <- copy _gap
-  45   var left/eax: (addr code-point-utf8-stack) <- get gap, left
+  45   var left/eax: (addr grapheme-stack) <- get gap, left
   46   var left-data-ah/eax: (addr handle array code-point-utf8) <- get left, data
   47   var left-data/eax: (addr array code-point-utf8) <- lookup *left-data-ah
   48   var result/eax: int <- length left-data
@@ -150,15 +150,15 @@ if ('onhashchange' in window) {
   86 
   87 fn append-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) {
   88   var self/esi: (addr gap-buffer) <- copy _self
-  89   var left/eax: (addr code-point-utf8-stack) <- get self, left
+  89   var left/eax: (addr grapheme-stack) <- get self, left
   90   emit-stack-from-bottom left, out
-  91   var right/eax: (addr code-point-utf8-stack) <- get self, right
+  91   var right/eax: (addr grapheme-stack) <- get self, right
   92   emit-stack-from-top right, out
   93 }
   94 
   95 # dump stack from bottom to top
-  96 fn emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream byte) {
-  97   var self/esi: (addr code-point-utf8-stack) <- copy _self
+  96 fn emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte) {
+  97   var self/esi: (addr grapheme-stack) <- copy _self
   98   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
   99   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  100   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -175,8 +175,8 @@ if ('onhashchange' in window) {
  111 }
  112 
  113 # dump stack from top to bottom
- 114 fn emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream byte) {
- 115   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 114 fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
+ 115   var self/esi: (addr grapheme-stack) <- copy _self
  116   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  117   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  118   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -203,10 +203,10 @@ if ('onhashchange' in window) {
  139     break-if-!=
  140     return
  141   }
- 142   var left/ecx: (addr code-point-utf8-stack) <- get self, left
+ 142   var left/ecx: (addr grapheme-stack) <- get self, left
  143   var left-index/eax: int <- top-most-word left
  144   emit-stack-from-index left, left-index, out
- 145   var right/ecx: (addr code-point-utf8-stack) <- get self, right
+ 145   var right/ecx: (addr grapheme-stack) <- get self, right
  146   var right-index/eax: int <- top-most-word right
  147   emit-stack-to-index right, right-index, out
  148 }
@@ -307,7 +307,7 @@ if ('onhashchange' in window) {
  243 fn code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
  244   # send top of right most of the time
  245   var self/esi: (addr gap-buffer) <- copy _self
- 246   var right/edi: (addr code-point-utf8-stack) <- get self, right
+ 246   var right/edi: (addr grapheme-stack) <- get self, right
  247   var data-ah/eax: (addr handle array code-point-utf8) <- get right, data
  248   var data/eax: (addr array code-point-utf8) <- lookup *data-ah
  249   var top-addr/ecx: (addr int) <- get right, top
@@ -320,7 +320,7 @@ if ('onhashchange' in window) {
  256     return *result
  257   }
  258   # send top of left only if right is empty
- 259   var left/edi: (addr code-point-utf8-stack) <- get self, left
+ 259   var left/edi: (addr grapheme-stack) <- get self, left
  260   var data-ah/eax: (addr handle array code-point-utf8) <- get left, data
  261   var data/eax: (addr array code-point-utf8) <- lookup *data-ah
  262   var top-addr/ecx: (addr int) <- get left, top
@@ -336,8 +336,8 @@ if ('onhashchange' in window) {
  272   return 0
  273 }
  274 
- 275 fn top-most-word _self: (addr code-point-utf8-stack) -> _/eax: int {
- 276   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 275 fn top-most-word _self: (addr grapheme-stack) -> _/eax: int {
+ 276   var self/esi: (addr grapheme-stack) <- copy _self
  277   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  278   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  279   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -358,8 +358,8 @@ if ('onhashchange' in window) {
  294   return i
  295 }
  296 
- 297 fn emit-stack-from-index _self: (addr code-point-utf8-stack), start: int, out: (addr stream byte) {
- 298   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 297 fn emit-stack-from-index _self: (addr grapheme-stack), start: int, out: (addr stream byte) {
+ 298   var self/esi: (addr grapheme-stack) <- copy _self
  299   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  300   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  301   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -375,8 +375,8 @@ if ('onhashchange' in window) {
  311   }
  312 }
  313 
- 314 fn emit-stack-to-index _self: (addr code-point-utf8-stack), end: int, out: (addr stream byte) {
- 315   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 314 fn emit-stack-to-index _self: (addr grapheme-stack), end: int, out: (addr stream byte) {
+ 315   var self/esi: (addr grapheme-stack) <- copy _self
  316   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  317   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  318   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -448,14 +448,14 @@ if ('onhashchange' in window) {
  384 # cursor is a single other color.
  385 fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int {
  386   var gap/esi: (addr gap-buffer) <- copy _gap
- 387   var left/edx: (addr code-point-utf8-stack) <- get gap, left
+ 387   var left/edx: (addr grapheme-stack) <- get gap, left
  388   var highlight-matching-open-paren?/ebx: boolean <- copy 0/false
  389   var matching-open-paren-depth/edi: int <- copy 0
  390   highlight-matching-open-paren?, matching-open-paren-depth <- highlight-matching-open-paren? gap, render-cursor?
  391   var x2/eax: int <- copy 0
  392   var y2/ecx: int <- copy 0
  393   x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, left, xmin, ymin, xmax, ymax, xmin, ymin, highlight-matching-open-paren?, matching-open-paren-depth, color, background-color
- 394   var right/edx: (addr code-point-utf8-stack) <- get gap, right
+ 394   var right/edx: (addr grapheme-stack) <- get gap, right
  395   x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, right, xmin, ymin, xmax, ymax, x2, y2, render-cursor?, color, background-color
  396   # decide whether we still need to print a cursor
  397   var fg/edi: int <- copy color
@@ -464,7 +464,7 @@ if ('onhashchange' in window) {
  400   {
  401     break-if-=
  402     # if the right side is empty, code-point-utf8 stack didn't print the cursor
- 403     var empty?/eax: boolean <- code-point-utf8-stack-empty? right
+ 403     var empty?/eax: boolean <- grapheme-stack-empty? right
  404     compare empty?, 0/false
  405     break-if-=
  406     # swap foreground and background
@@ -491,10 +491,10 @@ if ('onhashchange' in window) {
  427 
  428 fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int {
  429   var gap/esi: (addr gap-buffer) <- copy _gap
- 430   var left/eax: (addr code-point-utf8-stack) <- get gap, left
+ 430   var left/eax: (addr grapheme-stack) <- get gap, left
  431   var tmp/eax: (addr int) <- get left, top
  432   var left-length/ecx: int <- copy *tmp
- 433   var right/esi: (addr code-point-utf8-stack) <- get gap, right
+ 433   var right/esi: (addr grapheme-stack) <- get gap, right
  434   tmp <- get right, top
  435   var result/eax: int <- copy *tmp
  436   result <- add left-length
@@ -503,8 +503,8 @@ if ('onhashchange' in window) {
  439 
  440 fn add-code-point-utf8-at-gap _self: (addr gap-buffer), g: code-point-utf8 {
  441   var self/esi: (addr gap-buffer) <- copy _self
- 442   var left/eax: (addr code-point-utf8-stack) <- get self, left
- 443   push-code-point-utf8-stack left, g
+ 442   var left/eax: (addr grapheme-stack) <- get self, left
+ 443   push-grapheme-stack left, g
  444 }
  445 
  446 fn add-code-point-at-gap self: (addr gap-buffer), c: code-point {
@@ -530,28 +530,28 @@ if ('onhashchange' in window) {
  466 
  467 fn gap-at-start? _self: (addr gap-buffer) -> _/eax: boolean {
  468   var self/esi: (addr gap-buffer) <- copy _self
- 469   var left/eax: (addr code-point-utf8-stack) <- get self, left
- 470   var result/eax: boolean <- code-point-utf8-stack-empty? left
+ 469   var left/eax: (addr grapheme-stack) <- get self, left
+ 470   var result/eax: boolean <- grapheme-stack-empty? left
  471   return result
  472 }
  473 
  474 fn gap-at-end? _self: (addr gap-buffer) -> _/eax: boolean {
  475   var self/esi: (addr gap-buffer) <- copy _self
- 476   var right/eax: (addr code-point-utf8-stack) <- get self, right
- 477   var result/eax: boolean <- code-point-utf8-stack-empty? right
+ 476   var right/eax: (addr grapheme-stack) <- get self, right
+ 477   var result/eax: boolean <- grapheme-stack-empty? right
  478   return result
  479 }
  480 
  481 fn gap-right _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
  482   var self/esi: (addr gap-buffer) <- copy _self
  483   var g/eax: code-point-utf8 <- copy 0
- 484   var right/ecx: (addr code-point-utf8-stack) <- get self, right
- 485   g <- pop-code-point-utf8-stack right
+ 484   var right/ecx: (addr grapheme-stack) <- get self, right
+ 485   g <- pop-grapheme-stack right
  486   compare g, -1
  487   {
  488     break-if-=
- 489     var left/ecx: (addr code-point-utf8-stack) <- get self, left
- 490     push-code-point-utf8-stack left, g
+ 489     var left/ecx: (addr grapheme-stack) <- get self, left
+ 490     push-grapheme-stack left, g
  491   }
  492   return g
  493 }
@@ -560,21 +560,21 @@ if ('onhashchange' in window) {
  496   var self/esi: (addr gap-buffer) <- copy _self
  497   var g/eax: code-point-utf8 <- copy 0
  498   {
- 499     var left/ecx: (addr code-point-utf8-stack) <- get self, left
- 500     g <- pop-code-point-utf8-stack left
+ 499     var left/ecx: (addr grapheme-stack) <- get self, left
+ 500     g <- pop-grapheme-stack left
  501   }
  502   compare g, -1
  503   {
  504     break-if-=
- 505     var right/ecx: (addr code-point-utf8-stack) <- get self, right
- 506     push-code-point-utf8-stack right, g
+ 505     var right/ecx: (addr grapheme-stack) <- get self, right
+ 506     push-grapheme-stack right, g
  507   }
  508   return g
  509 }
  510 
  511 fn index-of-gap _self: (addr gap-buffer) -> _/eax: int {
  512   var self/eax: (addr gap-buffer) <- copy _self
- 513   var left/eax: (addr code-point-utf8-stack) <- get self, left
+ 513   var left/eax: (addr grapheme-stack) <- get self, left
  514   var top-addr/eax: (addr int) <- get left, top
  515   var result/eax: int <- copy *top-addr
  516   return result
@@ -583,7 +583,7 @@ if ('onhashchange' in window) {
  519 fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
  520   var self/esi: (addr gap-buffer) <- copy _self
  521   # try to read from left
- 522   var left/eax: (addr code-point-utf8-stack) <- get self, left
+ 522   var left/eax: (addr grapheme-stack) <- get self, left
  523   var top-addr/ecx: (addr int) <- get left, top
  524   compare *top-addr, 0
  525   {
@@ -594,7 +594,7 @@ if ('onhashchange' in window) {
  530     return *result-addr
  531   }
  532   # try to read from right
- 533   var right/eax: (addr code-point-utf8-stack) <- get self, right
+ 533   var right/eax: (addr grapheme-stack) <- get self, right
  534   top-addr <- get right, top
  535   compare *top-addr, 0
  536   {
@@ -613,13 +613,13 @@ if ('onhashchange' in window) {
  549 fn code-point-utf8-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
  550   var self/esi: (addr gap-buffer) <- copy _self
  551   # try to read from left
- 552   var left/ecx: (addr code-point-utf8-stack) <- get self, left
+ 552   var left/ecx: (addr grapheme-stack) <- get self, left
  553   var top-addr/edx: (addr int) <- get left, top
  554   compare *top-addr, 0
  555   {
  556     break-if-<=
- 557     var result/eax: code-point-utf8 <- pop-code-point-utf8-stack left
- 558     push-code-point-utf8-stack left, result
+ 557     var result/eax: code-point-utf8 <- pop-grapheme-stack left
+ 558     push-grapheme-stack left, result
  559     return result
  560   }
  561   # give up
@@ -628,14 +628,14 @@ if ('onhashchange' in window) {
  564 
  565 fn delete-before-gap _self: (addr gap-buffer) {
  566   var self/eax: (addr gap-buffer) <- copy _self
- 567   var left/eax: (addr code-point-utf8-stack) <- get self, left
- 568   var dummy/eax: code-point-utf8 <- pop-code-point-utf8-stack left
+ 567   var left/eax: (addr grapheme-stack) <- get self, left
+ 568   var dummy/eax: code-point-utf8 <- pop-grapheme-stack left
  569 }
  570 
  571 fn pop-after-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
  572   var self/eax: (addr gap-buffer) <- copy _self
- 573   var right/eax: (addr code-point-utf8-stack) <- get self, right
- 574   var result/eax: code-point-utf8 <- pop-code-point-utf8-stack right
+ 573   var right/eax: (addr grapheme-stack) <- get self, right
+ 574   var result/eax: code-point-utf8 <- pop-grapheme-stack right
  575   return result
  576 }
  577 
@@ -648,7 +648,7 @@ if ('onhashchange' in window) {
  584   var expected-stream/ecx: (addr stream byte) <- address stream-storage
  585   write expected-stream, s
  586   # compare left
- 587   var left/edx: (addr code-point-utf8-stack) <- get self, left
+ 587   var left/edx: (addr grapheme-stack) <- get self, left
  588   var result/eax: boolean <- prefix-match? left, expected-stream
  589   compare result, 0/false
  590   {
@@ -656,7 +656,7 @@ if ('onhashchange' in window) {
  592     return result
  593   }
  594   # compare right
- 595   var right/edx: (addr code-point-utf8-stack) <- get self, right
+ 595   var right/edx: (addr grapheme-stack) <- get self, right
  596   result <- suffix-match? right, expected-stream
  597   compare result, 0/false
  598   {
@@ -755,7 +755,7 @@ if ('onhashchange' in window) {
  691   var self/esi: (addr gap-buffer) <- copy _self
  692   var n/ebx: int <- copy _n
  693   # if n < left->length, index into left
- 694   var left/edi: (addr code-point-utf8-stack) <- get self, left
+ 694   var left/edi: (addr grapheme-stack) <- get self, left
  695   var left-len-a/edx: (addr int) <- get left, top
  696   compare n, *left-len-a
  697   {
@@ -768,7 +768,7 @@ if ('onhashchange' in window) {
  704   # shrink n
  705   n <- subtract *left-len-a
  706   # if n < right->length, index into right
- 707   var right/edi: (addr code-point-utf8-stack) <- get self, right
+ 707   var right/edi: (addr grapheme-stack) <- get self, right
  708   var right-len-a/edx: (addr int) <- get right, top
  709   compare n, *right-len-a
  710   {
@@ -852,25 +852,25 @@ if ('onhashchange' in window) {
  788   var dest-ah/eax: (addr handle gap-buffer) <- copy _dest-ah
  789   var _dest-a/eax: (addr gap-buffer) <- lookup *dest-ah
  790   var dest-a/edi: (addr gap-buffer) <- copy _dest-a
- 791   # copy left code-point-utf8-stack
- 792   var src/ecx: (addr code-point-utf8-stack) <- get src-a, left
- 793   var dest/edx: (addr code-point-utf8-stack) <- get dest-a, left
- 794   copy-code-point-utf8-stack src, dest
- 795   # copy right code-point-utf8-stack
+ 791   # copy left grapheme-stack
+ 792   var src/ecx: (addr grapheme-stack) <- get src-a, left
+ 793   var dest/edx: (addr grapheme-stack) <- get dest-a, left
+ 794   copy-grapheme-stack src, dest
+ 795   # copy right grapheme-stack
  796   src <- get src-a, right
  797   dest <- get dest-a, right
- 798   copy-code-point-utf8-stack src, dest
+ 798   copy-grapheme-stack src, dest
  799 }
  800 
  801 fn gap-buffer-is-decimal-integer? _self: (addr gap-buffer) -> _/eax: boolean {
  802   var self/esi: (addr gap-buffer) <- copy _self
- 803   var curr/ecx: (addr code-point-utf8-stack) <- get self, left
- 804   var result/eax: boolean <- code-point-utf8-stack-is-decimal-integer? curr
+ 803   var curr/ecx: (addr grapheme-stack) <- get self, left
+ 804   var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
  805   {
  806     compare result, 0/false
  807     break-if-=
  808     curr <- get self, right
- 809     result <- code-point-utf8-stack-is-decimal-integer? curr
+ 809     result <- grapheme-stack-is-decimal-integer? curr
  810   }
  811   return result
  812 }
@@ -1011,7 +1011,7 @@ if ('onhashchange' in window) {
  947     return 0/false, 0
  948   }
  949   var gap/esi: (addr gap-buffer) <- copy _gap
- 950   var stack/edi: (addr code-point-utf8-stack) <- get gap, right
+ 950   var stack/edi: (addr grapheme-stack) <- get gap, right
  951   var top-addr/eax: (addr int) <- get stack, top
  952   var top-index/ecx: int <- copy *top-addr
  953   compare top-index, 0
@@ -1086,8 +1086,8 @@ if ('onhashchange' in window) {
 1022 fn gap-buffer-scan-done? _self: (addr gap-buffer) -> _/eax: boolean {
 1023   var self/esi: (addr gap-buffer) <- copy _self
 1024   # more in left?
-1025   var left/eax: (addr code-point-utf8-stack) <- get self, left
-1026   var left-size/eax: int <- code-point-utf8-stack-length left
+1025   var left/eax: (addr grapheme-stack) <- get self, left
+1026   var left-size/eax: int <- grapheme-stack-length left
 1027   var left-read-index/ecx: (addr int) <- get self, left-read-index
 1028   compare *left-read-index, left-size
 1029   {
@@ -1095,8 +1095,8 @@ if ('onhashchange' in window) {
 1031     return 0/false
 1032   }
 1033   # more in right?
-1034   var right/eax: (addr code-point-utf8-stack) <- get self, right
-1035   var right-size/eax: int <- code-point-utf8-stack-length right
+1034   var right/eax: (addr grapheme-stack) <- get self, right
+1035   var right-size/eax: int <- grapheme-stack-length right
 1036   var right-read-index/ecx: (addr int) <- get self, right-read-index
 1037   compare *right-read-index, right-size
 1038   {
@@ -1110,8 +1110,8 @@ if ('onhashchange' in window) {
 1046 fn peek-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 1047   var self/esi: (addr gap-buffer) <- copy _self
 1048   # more in left?
-1049   var left/ecx: (addr code-point-utf8-stack) <- get self, left
-1050   var left-size/eax: int <- code-point-utf8-stack-length left
+1049   var left/ecx: (addr grapheme-stack) <- get self, left
+1050   var left-size/eax: int <- grapheme-stack-length left
 1051   var left-read-index-a/edx: (addr int) <- get self, left-read-index
 1052   compare *left-read-index-a, left-size
 1053   {
@@ -1123,8 +1123,8 @@ if ('onhashchange' in window) {
 1059     return *result
 1060   }
 1061   # more in right?
-1062   var right/ecx: (addr code-point-utf8-stack) <- get self, right
-1063   var _right-size/eax: int <- code-point-utf8-stack-length right
+1062   var right/ecx: (addr grapheme-stack) <- get self, right
+1063   var _right-size/eax: int <- grapheme-stack-length right
 1064   var right-size/ebx: int <- copy _right-size
 1065   var right-read-index-a/edx: (addr int) <- get self, right-read-index
 1066   compare *right-read-index-a, right-size
@@ -1146,8 +1146,8 @@ if ('onhashchange' in window) {
 1082 fn read-from-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 1083   var self/esi: (addr gap-buffer) <- copy _self
 1084   # more in left?
-1085   var left/ecx: (addr code-point-utf8-stack) <- get self, left
-1086   var left-size/eax: int <- code-point-utf8-stack-length left
+1085   var left/ecx: (addr grapheme-stack) <- get self, left
+1086   var left-size/eax: int <- grapheme-stack-length left
 1087   var left-read-index-a/edx: (addr int) <- get self, left-read-index
 1088   compare *left-read-index-a, left-size
 1089   {
@@ -1160,8 +1160,8 @@ if ('onhashchange' in window) {
 1096     return *result
 1097   }
 1098   # more in right?
-1099   var right/ecx: (addr code-point-utf8-stack) <- get self, right
-1100   var _right-size/eax: int <- code-point-utf8-stack-length right
+1099   var right/ecx: (addr grapheme-stack) <- get self, right
+1100   var _right-size/eax: int <- grapheme-stack-length right
 1101   var right-size/ebx: int <- copy _right-size
 1102   var right-read-index-a/edx: (addr int) <- get self, right-read-index
 1103   compare *right-read-index-a, right-size
@@ -1184,8 +1184,8 @@ if ('onhashchange' in window) {
 1120 fn put-back-from-gap-buffer _self: (addr gap-buffer) {
 1121   var self/esi: (addr gap-buffer) <- copy _self
 1122   # more in right?
-1123   var right/eax: (addr code-point-utf8-stack) <- get self, right
-1124   var right-size/eax: int <- code-point-utf8-stack-length right
+1123   var right/eax: (addr grapheme-stack) <- get self, right
+1124   var right-size/eax: int <- grapheme-stack-length right
 1125   var right-read-index-a/eax: (addr int) <- get self, right-read-index
 1126   compare *right-read-index-a, 0
 1127   {
@@ -1194,8 +1194,8 @@ if ('onhashchange' in window) {
 1130     return
 1131   }
 1132   # more in left?
-1133   var left/eax: (addr code-point-utf8-stack) <- get self, left
-1134   var left-size/eax: int <- code-point-utf8-stack-length left
+1133   var left/eax: (addr grapheme-stack) <- get self, left
+1134   var left-size/eax: int <- grapheme-stack-length left
 1135   var left-read-index-a/eax: (addr int) <- get self, left-read-index
 1136   decrement *left-read-index-a
 1137 }
diff --git a/html/linux/tile/gap-buffer.mu.html b/html/linux/tile/gap-buffer.mu.html
index 8adacb5b..fba0c57b 100644
--- a/html/linux/tile/gap-buffer.mu.html
+++ b/html/linux/tile/gap-buffer.mu.html
@@ -62,16 +62,16 @@ if ('onhashchange' in window) {
 https://github.com/akkartik/mu/blob/main/linux/tile/gap-buffer.mu
 
   1 type gap-buffer {
-  2   left: code-point-utf8-stack
-  3   right: code-point-utf8-stack
+  2   left: grapheme-stack
+  3   right: grapheme-stack
   4 }
   5 
   6 fn initialize-gap-buffer _self: (addr gap-buffer) {
   7   var self/esi: (addr gap-buffer) <- copy _self
-  8   var left/eax: (addr code-point-utf8-stack) <- get self, left
-  9   initialize-code-point-utf8-stack left, 0x10/max-word-size
- 10   var right/eax: (addr code-point-utf8-stack) <- get self, right
- 11   initialize-code-point-utf8-stack right, 0x10/max-word-size
+  8   var left/eax: (addr grapheme-stack) <- get self, left
+  9   initialize-grapheme-stack left, 0x10/max-word-size
+ 10   var right/eax: (addr grapheme-stack) <- get self, right
+ 11   initialize-grapheme-stack right, 0x10/max-word-size
  12 }
  13 
  14 # just for tests
@@ -100,15 +100,15 @@ if ('onhashchange' in window) {
  37 fn emit-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) {
  38   var self/esi: (addr gap-buffer) <- copy _self
  39   clear-stream out
- 40   var left/eax: (addr code-point-utf8-stack) <- get self, left
+ 40   var left/eax: (addr grapheme-stack) <- get self, left
  41   emit-stack-from-bottom left, out
- 42   var right/eax: (addr code-point-utf8-stack) <- get self, right
+ 42   var right/eax: (addr grapheme-stack) <- get self, right
  43   emit-stack-from-top right, out
  44 }
  45 
  46 # dump stack from bottom to top
- 47 fn emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream byte) {
- 48   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 47 fn emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte) {
+ 48   var self/esi: (addr grapheme-stack) <- copy _self
  49   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  50   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  51   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -125,8 +125,8 @@ if ('onhashchange' in window) {
  62 }
  63 
  64 # dump stack from top to bottom
- 65 fn emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream byte) {
- 66   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 65 fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) {
+ 66   var self/esi: (addr grapheme-stack) <- copy _self
  67   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  68   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  69   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -145,18 +145,18 @@ if ('onhashchange' in window) {
  82 
  83 fn render-gap-buffer screen: (addr screen), _gap: (addr gap-buffer) {
  84   var gap/esi: (addr gap-buffer) <- copy _gap
- 85   var left/eax: (addr code-point-utf8-stack) <- get gap, left
+ 85   var left/eax: (addr grapheme-stack) <- get gap, left
  86   render-stack-from-bottom left, screen
- 87   var right/eax: (addr code-point-utf8-stack) <- get gap, right
+ 87   var right/eax: (addr grapheme-stack) <- get gap, right
  88   render-stack-from-top right, screen
  89 }
  90 
  91 fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int {
  92   var gap/esi: (addr gap-buffer) <- copy _gap
- 93   var left/eax: (addr code-point-utf8-stack) <- get gap, left
+ 93   var left/eax: (addr grapheme-stack) <- get gap, left
  94   var tmp/eax: (addr int) <- get left, top
  95   var left-length/ecx: int <- copy *tmp
- 96   var right/esi: (addr code-point-utf8-stack) <- get gap, right
+ 96   var right/esi: (addr grapheme-stack) <- get gap, right
  97   tmp <- get right, top
  98   var result/eax: int <- copy *tmp
  99   result <- add left-length
@@ -165,8 +165,8 @@ if ('onhashchange' in window) {
 102 
 103 fn add-code-point-utf8-at-gap _self: (addr gap-buffer), g: code-point-utf8 {
 104   var self/esi: (addr gap-buffer) <- copy _self
-105   var left/eax: (addr code-point-utf8-stack) <- get self, left
-106   push-code-point-utf8-stack left, g
+105   var left/eax: (addr grapheme-stack) <- get self, left
+106   push-grapheme-stack left, g
 107 }
 108 
 109 fn gap-to-start self: (addr gap-buffer) {
@@ -187,28 +187,28 @@ if ('onhashchange' in window) {
 124 
 125 fn gap-at-start? _self: (addr gap-buffer) -> _/eax: boolean {
 126   var self/esi: (addr gap-buffer) <- copy _self
-127   var left/eax: (addr code-point-utf8-stack) <- get self, left
-128   var result/eax: boolean <- code-point-utf8-stack-empty? left
+127   var left/eax: (addr grapheme-stack) <- get self, left
+128   var result/eax: boolean <- grapheme-stack-empty? left
 129   return result
 130 }
 131 
 132 fn gap-at-end? _self: (addr gap-buffer) -> _/eax: boolean {
 133   var self/esi: (addr gap-buffer) <- copy _self
-134   var right/eax: (addr code-point-utf8-stack) <- get self, right
-135   var result/eax: boolean <- code-point-utf8-stack-empty? right
+134   var right/eax: (addr grapheme-stack) <- get self, right
+135   var result/eax: boolean <- grapheme-stack-empty? right
 136   return result
 137 }
 138 
 139 fn gap-right _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 140   var self/esi: (addr gap-buffer) <- copy _self
 141   var g/eax: code-point-utf8 <- copy 0
-142   var right/ecx: (addr code-point-utf8-stack) <- get self, right
-143   g <- pop-code-point-utf8-stack right
+142   var right/ecx: (addr grapheme-stack) <- get self, right
+143   g <- pop-grapheme-stack right
 144   compare g, -1
 145   {
 146     break-if-=
-147     var left/ecx: (addr code-point-utf8-stack) <- get self, left
-148     push-code-point-utf8-stack left, g
+147     var left/ecx: (addr grapheme-stack) <- get self, left
+148     push-grapheme-stack left, g
 149   }
 150   return g
 151 }
@@ -217,21 +217,21 @@ if ('onhashchange' in window) {
 154   var self/esi: (addr gap-buffer) <- copy _self
 155   var g/eax: code-point-utf8 <- copy 0
 156   {
-157     var left/ecx: (addr code-point-utf8-stack) <- get self, left
-158     g <- pop-code-point-utf8-stack left
+157     var left/ecx: (addr grapheme-stack) <- get self, left
+158     g <- pop-grapheme-stack left
 159   }
 160   compare g, -1
 161   {
 162     break-if-=
-163     var right/ecx: (addr code-point-utf8-stack) <- get self, right
-164     push-code-point-utf8-stack right, g
+163     var right/ecx: (addr grapheme-stack) <- get self, right
+164     push-grapheme-stack right, g
 165   }
 166   return g
 167 }
 168 
 169 fn gap-index _self: (addr gap-buffer) -> _/eax: int {
 170   var self/eax: (addr gap-buffer) <- copy _self
-171   var left/eax: (addr code-point-utf8-stack) <- get self, left
+171   var left/eax: (addr grapheme-stack) <- get self, left
 172   var top-addr/eax: (addr int) <- get left, top
 173   var result/eax: int <- copy *top-addr
 174   return result
@@ -240,7 +240,7 @@ if ('onhashchange' in window) {
 177 fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 178   var self/esi: (addr gap-buffer) <- copy _self
 179   # try to read from left
-180   var left/eax: (addr code-point-utf8-stack) <- get self, left
+180   var left/eax: (addr grapheme-stack) <- get self, left
 181   var top-addr/ecx: (addr int) <- get left, top
 182   compare *top-addr, 0
 183   {
@@ -251,7 +251,7 @@ if ('onhashchange' in window) {
 188     return *result-addr
 189   }
 190   # try to read from right
-191   var right/eax: (addr code-point-utf8-stack) <- get self, right
+191   var right/eax: (addr grapheme-stack) <- get self, right
 192   top-addr <- get right, top
 193   compare *top-addr, 0
 194   {
@@ -270,13 +270,13 @@ if ('onhashchange' in window) {
 207 fn code-point-utf8-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 208   var self/esi: (addr gap-buffer) <- copy _self
 209   # try to read from left
-210   var left/ecx: (addr code-point-utf8-stack) <- get self, left
+210   var left/ecx: (addr grapheme-stack) <- get self, left
 211   var top-addr/edx: (addr int) <- get left, top
 212   compare *top-addr, 0
 213   {
 214     break-if-<=
-215     var result/eax: code-point-utf8 <- pop-code-point-utf8-stack left
-216     push-code-point-utf8-stack left, result
+215     var result/eax: code-point-utf8 <- pop-grapheme-stack left
+216     push-grapheme-stack left, result
 217     return result
 218   }
 219   # give up
@@ -285,14 +285,14 @@ if ('onhashchange' in window) {
 222 
 223 fn delete-before-gap _self: (addr gap-buffer) {
 224   var self/eax: (addr gap-buffer) <- copy _self
-225   var left/eax: (addr code-point-utf8-stack) <- get self, left
-226   var dummy/eax: code-point-utf8 <- pop-code-point-utf8-stack left
+225   var left/eax: (addr grapheme-stack) <- get self, left
+226   var dummy/eax: code-point-utf8 <- pop-grapheme-stack left
 227 }
 228 
 229 fn pop-after-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
 230   var self/eax: (addr gap-buffer) <- copy _self
-231   var right/eax: (addr code-point-utf8-stack) <- get self, right
-232   var result/eax: code-point-utf8 <- pop-code-point-utf8-stack right
+231   var right/eax: (addr grapheme-stack) <- get self, right
+232   var result/eax: code-point-utf8 <- pop-grapheme-stack right
 233   return result
 234 }
 235 
@@ -305,7 +305,7 @@ if ('onhashchange' in window) {
 242   var expected-stream/ecx: (addr stream byte) <- address stream-storage
 243   write expected-stream, s
 244   # compare left
-245   var left/edx: (addr code-point-utf8-stack) <- get self, left
+245   var left/edx: (addr grapheme-stack) <- get self, left
 246   var result/eax: boolean <- prefix-match? left, expected-stream
 247   compare result, 0/false
 248   {
@@ -313,7 +313,7 @@ if ('onhashchange' in window) {
 250     return result
 251   }
 252   # compare right
-253   var right/edx: (addr code-point-utf8-stack) <- get self, right
+253   var right/edx: (addr grapheme-stack) <- get self, right
 254   result <- suffix-match? right, expected-stream
 255   compare result, 0/false
 256   {
@@ -382,25 +382,25 @@ if ('onhashchange' in window) {
 319   var dest-ah/eax: (addr handle gap-buffer) <- copy _dest-ah
 320   var _dest-a/eax: (addr gap-buffer) <- lookup *dest-ah
 321   var dest-a/edi: (addr gap-buffer) <- copy _dest-a
-322   # copy left code-point-utf8-stack
-323   var src/ecx: (addr code-point-utf8-stack) <- get src-a, left
-324   var dest/edx: (addr code-point-utf8-stack) <- get dest-a, left
-325   copy-code-point-utf8-stack src, dest
-326   # copy right code-point-utf8-stack
+322   # copy left grapheme-stack
+323   var src/ecx: (addr grapheme-stack) <- get src-a, left
+324   var dest/edx: (addr grapheme-stack) <- get dest-a, left
+325   copy-grapheme-stack src, dest
+326   # copy right grapheme-stack
 327   src <- get src-a, right
 328   dest <- get dest-a, right
-329   copy-code-point-utf8-stack src, dest
+329   copy-grapheme-stack src, dest
 330 }
 331 
 332 fn gap-buffer-is-decimal-integer? _self: (addr gap-buffer) -> _/eax: boolean {
 333   var self/esi: (addr gap-buffer) <- copy _self
-334   var curr/ecx: (addr code-point-utf8-stack) <- get self, left
-335   var result/eax: boolean <- code-point-utf8-stack-is-decimal-integer? curr
+334   var curr/ecx: (addr grapheme-stack) <- get self, left
+335   var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
 336   {
 337     compare result, 0/false
 338     break-if-=
 339     curr <- get self, right
-340     result <- code-point-utf8-stack-is-decimal-integer? curr
+340     result <- grapheme-stack-is-decimal-integer? curr
 341   }
 342   return result
 343 }
diff --git a/html/linux/tile/grapheme-stack.mu.html b/html/linux/tile/grapheme-stack.mu.html
index d5a29921..398a6049 100644
--- a/html/linux/tile/grapheme-stack.mu.html
+++ b/html/linux/tile/grapheme-stack.mu.html
@@ -61,27 +61,27 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/main/linux/tile/grapheme-stack.mu
 
-  1 type code-point-utf8-stack {
+  1 type grapheme-stack {
   2   data: (handle array code-point-utf8)
   3   top: int
   4 }
   5 
-  6 fn initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int {
-  7   var self/esi: (addr code-point-utf8-stack) <- copy _self
+  6 fn initialize-grapheme-stack _self: (addr grapheme-stack), n: int {
+  7   var self/esi: (addr grapheme-stack) <- copy _self
   8   var d/edi: (addr handle array code-point-utf8) <- get self, data
   9   populate d, n
  10   var top/eax: (addr int) <- get self, top
  11   copy-to *top, 0
  12 }
  13 
- 14 fn clear-code-point-utf8-stack _self: (addr code-point-utf8-stack) {
- 15   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 14 fn clear-grapheme-stack _self: (addr grapheme-stack) {
+ 15   var self/esi: (addr grapheme-stack) <- copy _self
  16   var top/eax: (addr int) <- get self, top
  17   copy-to *top, 0
  18 }
  19 
- 20 fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
- 21   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 20 fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
+ 21   var self/esi: (addr grapheme-stack) <- copy _self
  22   var top/eax: (addr int) <- get self, top
  23   compare *top, 0
  24   {
@@ -91,8 +91,8 @@ if ('onhashchange' in window) {
  28   return 0/false
  29 }
  30 
- 31 fn push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-point-utf8 {
- 32   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 31 fn push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8 {
+ 32   var self/esi: (addr grapheme-stack) <- copy _self
  33   var top-addr/ecx: (addr int) <- get self, top
  34   var data-ah/edx: (addr handle array code-point-utf8) <- get self, data
  35   var data/eax: (addr array code-point-utf8) <- lookup *data-ah
@@ -103,8 +103,8 @@ if ('onhashchange' in window) {
  40   add-to *top-addr, 1
  41 }
  42 
- 43 fn pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-point-utf8 {
- 44   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 43 fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8 {
+ 44   var self/esi: (addr grapheme-stack) <- copy _self
  45   var top-addr/ecx: (addr int) <- get self, top
  46   {
  47     compare *top-addr, 0
@@ -119,8 +119,8 @@ if ('onhashchange' in window) {
  56   return *result-addr
  57 }
  58 
- 59 fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr code-point-utf8-stack) {
- 60   var src/esi: (addr code-point-utf8-stack) <- copy _src
+ 59 fn copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack) {
+ 60   var src/esi: (addr grapheme-stack) <- copy _src
  61   var data-ah/edi: (addr handle array code-point-utf8) <- get src, data
  62   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  63   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -130,7 +130,7 @@ if ('onhashchange' in window) {
  67     compare i, *top-addr
  68     break-if->=
  69     var g/edx: (addr code-point-utf8) <- index data, i
- 70     push-code-point-utf8-stack dest, *g
+ 70     push-grapheme-stack dest, *g
  71     i <- increment
  72     loop
  73   }
@@ -138,8 +138,8 @@ if ('onhashchange' in window) {
  75 
  76 # dump stack to screen from bottom to top
  77 # don't move the cursor or anything
- 78 fn render-stack-from-bottom _self: (addr code-point-utf8-stack), screen: (addr screen) {
- 79   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 78 fn render-stack-from-bottom _self: (addr grapheme-stack), screen: (addr screen) {
+ 79   var self/esi: (addr grapheme-stack) <- copy _self
  80   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
  81   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
  82   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -157,8 +157,8 @@ if ('onhashchange' in window) {
  94 
  95 # dump stack to screen from top to bottom
  96 # don't move the cursor or anything
- 97 fn render-stack-from-top _self: (addr code-point-utf8-stack), screen: (addr screen) {
- 98   var self/esi: (addr code-point-utf8-stack) <- copy _self
+ 97 fn render-stack-from-top _self: (addr grapheme-stack), screen: (addr screen) {
+ 98   var self/esi: (addr grapheme-stack) <- copy _self
  99   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
 100   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 101   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -177,8 +177,8 @@ if ('onhashchange' in window) {
 114 
 115 # compare from bottom
 116 # beware: modifies 'stream', which must be disposed of after a false result
-117 fn prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
-118   var self/esi: (addr code-point-utf8-stack) <- copy _self
+117 fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
+118   var self/esi: (addr grapheme-stack) <- copy _self
 119   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
 120   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 121   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -205,8 +205,8 @@ if ('onhashchange' in window) {
 142 
 143 # compare from bottom
 144 # beware: modifies 'stream', which must be disposed of after a false result
-145 fn suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean {
-146   var self/esi: (addr code-point-utf8-stack) <- copy _self
+145 fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean {
+146   var self/esi: (addr grapheme-stack) <- copy _self
 147   var data-ah/edi: (addr handle array code-point-utf8) <- get self, data
 148   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 149   var data/edi: (addr array code-point-utf8) <- copy _data
@@ -232,15 +232,15 @@ if ('onhashchange' in window) {
 169   return 1   # true
 170 }
 171 
-172 fn code-point-utf8-stack-is-decimal-integer? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
-173   var self/esi: (addr code-point-utf8-stack) <- copy _self
+172 fn grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boolean {
+173   var self/esi: (addr grapheme-stack) <- copy _self
 174   var data-ah/eax: (addr handle array code-point-utf8) <- get self, data
 175   var _data/eax: (addr array code-point-utf8) <- lookup *data-ah
 176   var data/edx: (addr array code-point-utf8) <- copy _data
 177   var top-addr/ecx: (addr int) <- get self, top
 178   var i/ebx: int <- copy 0
 179   var result/eax: boolean <- copy 1/true
-180   $code-point-utf8-stack-is-integer?:loop: {
+180   $grapheme-stack-is-integer?:loop: {
 181     compare i, *top-addr
 182     break-if->=
 183     var g/edx: (addr code-point-utf8) <- index data, i
diff --git a/html/linux/tile/word.mu.html b/html/linux/tile/word.mu.html
index 4d1e86d3..f5eaa88d 100644
--- a/html/linux/tile/word.mu.html
+++ b/html/linux/tile/word.mu.html
@@ -122,12 +122,12 @@ if ('onhashchange' in window) {
  58   cursor-to-start src
  59   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
  60   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
- 61   var src-stack/ecx: (addr code-point-utf8-stack) <- get src-data, right
+ 61   var src-stack/ecx: (addr grapheme-stack) <- get src-data, right
  62   {
- 63     var done?/eax: boolean <- code-point-utf8-stack-empty? src-stack
+ 63     var done?/eax: boolean <- grapheme-stack-empty? src-stack
  64     compare done?, 0/false
  65     break-if-!=
- 66     var g/eax: code-point-utf8 <- pop-code-point-utf8-stack src-stack
+ 66     var g/eax: code-point-utf8 <- pop-grapheme-stack src-stack
  67 #?     print-code-point-utf8 0, g
  68 #?     print-string 0, "\n"
  69     add-code-point-utf8-to-word dest, g
@@ -143,7 +143,7 @@ if ('onhashchange' in window) {
  79   var src/eax: (addr word) <- lookup *src-ah
  80   var src-data-ah/eax: (addr handle gap-buffer) <- get src, scalar-data
  81   var src-data/eax: (addr gap-buffer) <- lookup *src-data-ah
- 82   var src-stack/ecx: (addr code-point-utf8-stack) <- get src-data, left
+ 82   var src-stack/ecx: (addr grapheme-stack) <- get src-data, left
  83   var src-stack-data-ah/eax: (addr handle array code-point-utf8) <- get src-stack, data
  84   var _src-stack-data/eax: (addr array code-point-utf8) <- lookup *src-stack-data-ah
  85   var src-stack-data/edx: (addr array code-point-utf8) <- copy _src-stack-data
diff --git a/html/signatures.mu.html b/html/signatures.mu.html
index bead3889..90bb25eb 100644
--- a/html/signatures.mu.html
+++ b/html/signatures.mu.html
@@ -303,22 +303,22 @@ if ('onhashchange' in window) {
 242 sig find-slide-down-slot-in-array _a: (addr array int), _val: int -> _/ecx: int
 243 sig check-slide-up before: (addr array byte), start: int, end: int, target: int, after: (addr array byte), msg: (addr array byte)
 244 sig check-slide-down before: (addr array byte), start: int, end: int, target: int, after: (addr array byte), msg: (addr array byte)
-245 sig initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int
-246 sig clear-code-point-utf8-stack _self: (addr code-point-utf8-stack)
-247 sig code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean
-248 sig code-point-utf8-stack-length _self: (addr code-point-utf8-stack) -> _/eax: int
-249 sig push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-point-utf8
-250 sig pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-point-utf8
-251 sig copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr code-point-utf8-stack)
-252 sig render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int
-253 sig render-stack-from-bottom screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int
-254 sig render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
-255 sig render-stack-from-top screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int
-256 sig get-matching-close-paren-index _self: (addr code-point-utf8-stack), render-cursor?: boolean -> _/edx: int
-257 sig get-matching-open-paren-index _self: (addr code-point-utf8-stack), control: boolean, depth: int -> _/edx: int
-258 sig prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean
-259 sig suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean
-260 sig code-point-utf8-stack-is-decimal-integer? _self: (addr code-point-utf8-stack) -> _/eax: boolean
+245 sig initialize-grapheme-stack _self: (addr grapheme-stack), n: int
+246 sig clear-grapheme-stack _self: (addr grapheme-stack)
+247 sig grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean
+248 sig grapheme-stack-length _self: (addr grapheme-stack) -> _/eax: int
+249 sig push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8
+250 sig pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8
+251 sig copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack)
+252 sig render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int
+253 sig render-stack-from-bottom screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int
+254 sig render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
+255 sig render-stack-from-top screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int
+256 sig get-matching-close-paren-index _self: (addr grapheme-stack), render-cursor?: boolean -> _/edx: int
+257 sig get-matching-open-paren-index _self: (addr grapheme-stack), control: boolean, depth: int -> _/edx: int
+258 sig prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean
+259 sig suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean
+260 sig grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boolean
 261 sig initialize-gap-buffer _self: (addr gap-buffer), capacity: int
 262 sig clear-gap-buffer _self: (addr gap-buffer)
 263 sig gap-buffer-empty? _self: (addr gap-buffer) -> _/eax: boolean
@@ -327,13 +327,13 @@ if ('onhashchange' in window) {
 266 sig load-gap-buffer-from-stream self: (addr gap-buffer), in: (addr stream byte)
 267 sig emit-gap-buffer self: (addr gap-buffer), out: (addr stream byte)
 268 sig append-gap-buffer _self: (addr gap-buffer), out: (addr stream byte)
-269 sig emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream byte)
-270 sig emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream byte)
+269 sig emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte)
+270 sig emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte)
 271 sig word-at-gap _self: (addr gap-buffer), out: (addr stream byte)
 272 sig code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8
-273 sig top-most-word _self: (addr code-point-utf8-stack) -> _/eax: int
-274 sig emit-stack-from-index _self: (addr code-point-utf8-stack), start: int, out: (addr stream byte)
-275 sig emit-stack-to-index _self: (addr code-point-utf8-stack), end: int, out: (addr stream byte)
+273 sig top-most-word _self: (addr grapheme-stack) -> _/eax: int
+274 sig emit-stack-from-index _self: (addr grapheme-stack), start: int, out: (addr stream byte)
+275 sig emit-stack-to-index _self: (addr grapheme-stack), end: int, out: (addr stream byte)
 276 sig is-ascii-word-code-point-utf8? g: code-point-utf8 -> _/eax: boolean
 277 sig render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
 278 sig render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int
diff --git a/linux/tile/gap-buffer.mu b/linux/tile/gap-buffer.mu
index 1441684b..3c22501d 100644
--- a/linux/tile/gap-buffer.mu
+++ b/linux/tile/gap-buffer.mu
@@ -1,14 +1,14 @@
 type gap-buffer {
-  left: code-point-utf8-stack
-  right: code-point-utf8-stack
+  left: grapheme-stack
+  right: grapheme-stack
 }
 
 fn initialize-gap-buffer _self: (addr gap-buffer) {
   var self/esi: (addr gap-buffer) <- copy _self
-  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
+  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
 }
 
 # just for tests
@@ -37,15 +37,15 @@ 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 code-point-utf8-stack) <- get self, left
+  var left/eax: (addr grapheme-stack) <- get self, left
   emit-stack-from-bottom left, out
-  var right/eax: (addr code-point-utf8-stack) <- get self, right
+  var right/eax: (addr grapheme-stack) <- get self, right
   emit-stack-from-top right, out
 }
 
 # dump stack from bottom to top
-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
+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 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
@@ -62,8 +62,8 @@ fn emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream
 }
 
 # dump stack from top to bottom
-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
+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 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
@@ -82,18 +82,18 @@ fn emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream by
 
 fn render-gap-buffer screen: (addr screen), _gap: (addr gap-buffer) {
   var gap/esi: (addr gap-buffer) <- copy _gap
-  var left/eax: (addr code-point-utf8-stack) <- get gap, left
+  var left/eax: (addr grapheme-stack) <- get gap, left
   render-stack-from-bottom left, screen
-  var right/eax: (addr code-point-utf8-stack) <- get gap, right
+  var right/eax: (addr grapheme-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 code-point-utf8-stack) <- get gap, left
+  var left/eax: (addr grapheme-stack) <- get gap, left
   var tmp/eax: (addr int) <- get left, top
   var left-length/ecx: int <- copy *tmp
-  var right/esi: (addr code-point-utf8-stack) <- get gap, right
+  var right/esi: (addr grapheme-stack) <- get gap, right
   tmp <- get right, top
   var result/eax: int <- copy *tmp
   result <- add left-length
@@ -102,8 +102,8 @@ fn gap-buffer-length _gap: (addr gap-buffer) -> _/eax: int {
 
 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 code-point-utf8-stack) <- get self, left
-  push-code-point-utf8-stack left, g
+  var left/eax: (addr grapheme-stack) <- get self, left
+  push-grapheme-stack left, g
 }
 
 fn gap-to-start self: (addr gap-buffer) {
@@ -124,28 +124,28 @@ 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 code-point-utf8-stack) <- get self, left
-  var result/eax: boolean <- code-point-utf8-stack-empty? left
+  var left/eax: (addr grapheme-stack) <- get self, left
+  var result/eax: boolean <- grapheme-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 code-point-utf8-stack) <- get self, right
-  var result/eax: boolean <- code-point-utf8-stack-empty? right
+  var right/eax: (addr grapheme-stack) <- get self, right
+  var result/eax: boolean <- grapheme-stack-empty? right
   return result
 }
 
 fn gap-right _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
   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
+  var right/ecx: (addr grapheme-stack) <- get self, right
+  g <- pop-grapheme-stack right
   compare g, -1
   {
     break-if-=
-    var left/ecx: (addr code-point-utf8-stack) <- get self, left
-    push-code-point-utf8-stack left, g
+    var left/ecx: (addr grapheme-stack) <- get self, left
+    push-grapheme-stack left, g
   }
   return g
 }
@@ -154,21 +154,21 @@ fn gap-left _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/esi: (addr gap-buffer) <- copy _self
   var g/eax: code-point-utf8 <- copy 0
   {
-    var left/ecx: (addr code-point-utf8-stack) <- get self, left
-    g <- pop-code-point-utf8-stack left
+    var left/ecx: (addr grapheme-stack) <- get self, left
+    g <- pop-grapheme-stack left
   }
   compare g, -1
   {
     break-if-=
-    var right/ecx: (addr code-point-utf8-stack) <- get self, right
-    push-code-point-utf8-stack right, g
+    var right/ecx: (addr grapheme-stack) <- get self, right
+    push-grapheme-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 code-point-utf8-stack) <- get self, left
+  var left/eax: (addr grapheme-stack) <- get self, left
   var top-addr/eax: (addr int) <- get left, top
   var result/eax: int <- copy *top-addr
   return result
@@ -177,7 +177,7 @@ fn gap-index _self: (addr gap-buffer) -> _/eax: int {
 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 code-point-utf8-stack) <- get self, left
+  var left/eax: (addr grapheme-stack) <- get self, left
   var top-addr/ecx: (addr int) <- get left, top
   compare *top-addr, 0
   {
@@ -188,7 +188,7 @@ fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-p
     return *result-addr
   }
   # try to read from right
-  var right/eax: (addr code-point-utf8-stack) <- get self, right
+  var right/eax: (addr grapheme-stack) <- get self, right
   top-addr <- get right, top
   compare *top-addr, 0
   {
@@ -207,13 +207,13 @@ fn first-code-point-utf8-in-gap-buffer _self: (addr gap-buffer) -> _/eax: code-p
 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 code-point-utf8-stack) <- get self, left
+  var left/ecx: (addr grapheme-stack) <- get self, left
   var top-addr/edx: (addr int) <- get left, top
   compare *top-addr, 0
   {
     break-if-<=
-    var result/eax: code-point-utf8 <- pop-code-point-utf8-stack left
-    push-code-point-utf8-stack left, result
+    var result/eax: code-point-utf8 <- pop-grapheme-stack left
+    push-grapheme-stack left, result
     return result
   }
   # give up
@@ -222,14 +222,14 @@ fn code-point-utf8-before-cursor-in-gap-buffer _self: (addr gap-buffer) -> _/eax
 
 fn delete-before-gap _self: (addr gap-buffer) {
   var self/eax: (addr gap-buffer) <- copy _self
-  var left/eax: (addr code-point-utf8-stack) <- get self, left
-  var dummy/eax: code-point-utf8 <- pop-code-point-utf8-stack left
+  var left/eax: (addr grapheme-stack) <- get self, left
+  var dummy/eax: code-point-utf8 <- pop-grapheme-stack left
 }
 
 fn pop-after-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8 {
   var self/eax: (addr gap-buffer) <- copy _self
-  var right/eax: (addr code-point-utf8-stack) <- get self, right
-  var result/eax: code-point-utf8 <- pop-code-point-utf8-stack right
+  var right/eax: (addr grapheme-stack) <- get self, right
+  var result/eax: code-point-utf8 <- pop-grapheme-stack right
   return result
 }
 
@@ -242,7 +242,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo
   var expected-stream/ecx: (addr stream byte) <- address stream-storage
   write expected-stream, s
   # compare left
-  var left/edx: (addr code-point-utf8-stack) <- get self, left
+  var left/edx: (addr grapheme-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 code-point-utf8-stack) <- get self, right
+  var right/edx: (addr grapheme-stack) <- get self, right
   result <- suffix-match? right, expected-stream
   compare result, 0/false
   {
@@ -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 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
+  # 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
   src <- get src-a, right
   dest <- get dest-a, right
-  copy-code-point-utf8-stack src, dest
+  copy-grapheme-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 code-point-utf8-stack) <- get self, left
-  var result/eax: boolean <- code-point-utf8-stack-is-decimal-integer? curr
+  var curr/ecx: (addr grapheme-stack) <- get self, left
+  var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr
   {
     compare result, 0/false
     break-if-=
     curr <- get self, right
-    result <- code-point-utf8-stack-is-decimal-integer? curr
+    result <- grapheme-stack-is-decimal-integer? curr
   }
   return result
 }
diff --git a/linux/tile/grapheme-stack.mu b/linux/tile/grapheme-stack.mu
index c7565a1c..0966be6c 100644
--- a/linux/tile/grapheme-stack.mu
+++ b/linux/tile/grapheme-stack.mu
@@ -1,24 +1,24 @@
-type code-point-utf8-stack {
+type grapheme-stack {
   data: (handle array code-point-utf8)
   top: int
 }
 
-fn initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int {
-  var self/esi: (addr code-point-utf8-stack) <- copy _self
+fn initialize-grapheme-stack _self: (addr grapheme-stack), n: int {
+  var self/esi: (addr grapheme-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-code-point-utf8-stack _self: (addr code-point-utf8-stack) {
-  var self/esi: (addr code-point-utf8-stack) <- copy _self
+fn clear-grapheme-stack _self: (addr grapheme-stack) {
+  var self/esi: (addr grapheme-stack) <- copy _self
   var top/eax: (addr int) <- get self, top
   copy-to *top, 0
 }
 
-fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean {
-  var self/esi: (addr code-point-utf8-stack) <- copy _self
+fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean {
+  var self/esi: (addr grapheme-stack) <- copy _self
   var top/eax: (addr int) <- get self, top
   compare *top, 0
   {
@@ -28,8 +28,8 @@ fn code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: bo
   return 0/false
 }
 
-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
+fn push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8 {
+  var self/esi: (addr grapheme-stack) <- copy _self
   var top-addr/ecx: (addr int) <- get self, top
   var data-ah/edx: (addr handle array code-point-utf8) <- get self, data
   var data/eax: (addr array code-point-utf8) <- lookup *data-ah
@@ -40,8 +40,8 @@ fn push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-po
   add-to *top-addr, 1
 }
 
-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
+fn pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8 {
+  var self/esi: (addr grapheme-stack) <- copy _self
   var top-addr/ecx: (addr int) <- get self, top
   {
     compare *top-addr, 0
@@ -56,8 +56,8 @@ fn pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-
   return *result-addr
 }
 
-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
+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 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
@@ -67,7 +67,7 @@ fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr co
     compare i, *top-addr
     break-if->=
     var g/edx: (addr code-point-utf8) <- index data, i
-    push-code-point-utf8-stack dest, *g
+    push-grapheme-stack dest, *g
     i <- increment
     loop
   }
@@ -75,8 +75,8 @@ fn copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr co
 
 # dump stack to screen from bottom to top
 # don't move the cursor or anything
-fn render-stack-from-bottom _self: (addr code-point-utf8-stack), screen: (addr screen) {
-  var self/esi: (addr code-point-utf8-stack) <- copy _self
+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 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
@@ -94,8 +94,8 @@ fn render-stack-from-bottom _self: (addr code-point-utf8-stack), screen: (addr s
 
 # dump stack to screen from top to bottom
 # don't move the cursor or anything
-fn render-stack-from-top _self: (addr code-point-utf8-stack), screen: (addr screen) {
-  var self/esi: (addr code-point-utf8-stack) <- copy _self
+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 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
@@ -114,8 +114,8 @@ fn render-stack-from-top _self: (addr code-point-utf8-stack), screen: (addr scre
 
 # compare from bottom
 # beware: modifies 'stream', which must be disposed of after a false result
-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
+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 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
@@ -142,8 +142,8 @@ fn prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _
 
 # compare from bottom
 # beware: modifies 'stream', which must be disposed of after a false result
-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
+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 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
@@ -169,15 +169,15 @@ fn suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _
   return 1   # true
 }
 
-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
+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 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
-  $code-point-utf8-stack-is-integer?:loop: {
+  $grapheme-stack-is-integer?:loop: {
     compare i, *top-addr
     break-if->=
     var g/edx: (addr code-point-utf8) <- index data, i
diff --git a/linux/tile/word.mu b/linux/tile/word.mu
index 3b4851f0..ba4877fa 100644
--- a/linux/tile/word.mu
+++ b/linux/tile/word.mu
@@ -58,12 +58,12 @@ 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 code-point-utf8-stack) <- get src-data, right
+  var src-stack/ecx: (addr grapheme-stack) <- get src-data, right
   {
-    var done?/eax: boolean <- code-point-utf8-stack-empty? src-stack
+    var done?/eax: boolean <- grapheme-stack-empty? src-stack
     compare done?, 0/false
     break-if-!=
-    var g/eax: code-point-utf8 <- pop-code-point-utf8-stack src-stack
+    var g/eax: code-point-utf8 <- pop-grapheme-stack src-stack
 #?     print-code-point-utf8 0, g
 #?     print-string 0, "\n"
     add-code-point-utf8-to-word dest, g
@@ -79,7 +79,7 @@ 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 code-point-utf8-stack) <- get src-data, left
+  var src-stack/ecx: (addr grapheme-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
diff --git a/signatures.mu b/signatures.mu
index ee8ea5dd..0a34e0b8 100644
--- a/signatures.mu
+++ b/signatures.mu
@@ -242,22 +242,22 @@ sig slide-down _a: (addr array int), start: int, end: int, target: int
 sig find-slide-down-slot-in-array _a: (addr array int), _val: int -> _/ecx: int
 sig check-slide-up before: (addr array byte), start: int, end: int, target: int, after: (addr array byte), msg: (addr array byte)
 sig check-slide-down before: (addr array byte), start: int, end: int, target: int, after: (addr array byte), msg: (addr array byte)
-sig initialize-code-point-utf8-stack _self: (addr code-point-utf8-stack), n: int
-sig clear-code-point-utf8-stack _self: (addr code-point-utf8-stack)
-sig code-point-utf8-stack-empty? _self: (addr code-point-utf8-stack) -> _/eax: boolean
-sig code-point-utf8-stack-length _self: (addr code-point-utf8-stack) -> _/eax: int
-sig push-code-point-utf8-stack _self: (addr code-point-utf8-stack), _val: code-point-utf8
-sig pop-code-point-utf8-stack _self: (addr code-point-utf8-stack) -> _/eax: code-point-utf8
-sig copy-code-point-utf8-stack _src: (addr code-point-utf8-stack), dest: (addr code-point-utf8-stack)
-sig render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int
-sig render-stack-from-bottom screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int
-sig render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr code-point-utf8-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
-sig render-stack-from-top screen: (addr screen), self: (addr code-point-utf8-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int
-sig get-matching-close-paren-index _self: (addr code-point-utf8-stack), render-cursor?: boolean -> _/edx: int
-sig get-matching-open-paren-index _self: (addr code-point-utf8-stack), control: boolean, depth: int -> _/edx: int
-sig prefix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean
-sig suffix-match? _self: (addr code-point-utf8-stack), s: (addr stream byte) -> _/eax: boolean
-sig code-point-utf8-stack-is-decimal-integer? _self: (addr code-point-utf8-stack) -> _/eax: boolean
+sig initialize-grapheme-stack _self: (addr grapheme-stack), n: int
+sig clear-grapheme-stack _self: (addr grapheme-stack)
+sig grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean
+sig grapheme-stack-length _self: (addr grapheme-stack) -> _/eax: int
+sig push-grapheme-stack _self: (addr grapheme-stack), _val: code-point-utf8
+sig pop-grapheme-stack _self: (addr grapheme-stack) -> _/eax: code-point-utf8
+sig copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack)
+sig render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int
+sig render-stack-from-bottom screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int
+sig render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
+sig render-stack-from-top screen: (addr screen), self: (addr grapheme-stack), x: int, y: int, render-cursor?: boolean -> _/eax: int
+sig get-matching-close-paren-index _self: (addr grapheme-stack), render-cursor?: boolean -> _/edx: int
+sig get-matching-open-paren-index _self: (addr grapheme-stack), control: boolean, depth: int -> _/edx: int
+sig prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean
+sig suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: boolean
+sig grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boolean
 sig initialize-gap-buffer _self: (addr gap-buffer), capacity: int
 sig clear-gap-buffer _self: (addr gap-buffer)
 sig gap-buffer-empty? _self: (addr gap-buffer) -> _/eax: boolean
@@ -266,13 +266,13 @@ sig initialize-gap-buffer-with self: (addr gap-buffer), keys: (addr array byte)
 sig load-gap-buffer-from-stream self: (addr gap-buffer), in: (addr stream byte)
 sig emit-gap-buffer self: (addr gap-buffer), out: (addr stream byte)
 sig append-gap-buffer _self: (addr gap-buffer), out: (addr stream byte)
-sig emit-stack-from-bottom _self: (addr code-point-utf8-stack), out: (addr stream byte)
-sig emit-stack-from-top _self: (addr code-point-utf8-stack), out: (addr stream byte)
+sig emit-stack-from-bottom _self: (addr grapheme-stack), out: (addr stream byte)
+sig emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte)
 sig word-at-gap _self: (addr gap-buffer), out: (addr stream byte)
 sig code-point-utf8-at-gap _self: (addr gap-buffer) -> _/eax: code-point-utf8
-sig top-most-word _self: (addr code-point-utf8-stack) -> _/eax: int
-sig emit-stack-from-index _self: (addr code-point-utf8-stack), start: int, out: (addr stream byte)
-sig emit-stack-to-index _self: (addr code-point-utf8-stack), end: int, out: (addr stream byte)
+sig top-most-word _self: (addr grapheme-stack) -> _/eax: int
+sig emit-stack-from-index _self: (addr grapheme-stack), start: int, out: (addr stream byte)
+sig emit-stack-to-index _self: (addr grapheme-stack), end: int, out: (addr stream byte)
 sig is-ascii-word-code-point-utf8? g: code-point-utf8 -> _/eax: boolean
 sig render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int
 sig render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int