about summary refs log tree commit diff stats
path: root/403unicode.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-26 23:43:58 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-26 23:57:39 -0700
commit307a75530fc63939a2356bf99a04a8107d2ae800 (patch)
tree6ad4f8e5c79884c2f26cf46aaf363b5ecd2aa689 /403unicode.mu
parentc15b6e3fc6c7f2666e8de4bc138835139fc96fce (diff)
downloadmu-307a75530fc63939a2356bf99a04a8107d2ae800.tar.gz
7123 - tile: truncate string if necessary
Diffstat (limited to '403unicode.mu')
-rw-r--r--403unicode.mu8
1 files changed, 8 insertions, 0 deletions
diff --git a/403unicode.mu b/403unicode.mu
index dcb1e658..6de29bde 100644
--- a/403unicode.mu
+++ b/403unicode.mu
@@ -159,6 +159,14 @@ fn test-to-grapheme-four-bytes-max {
 # read the next grapheme from a stream of bytes
 fn read-grapheme in: (addr stream byte) -> out/eax: grapheme {
 $read-grapheme:body: {
+  # if at eof, return EOF
+  {
+    var eof?/eax: boolean <- stream-empty? in
+    compare eof?, 0  # false
+    break-if-=
+    out <- copy 0xffffffff
+    break $read-grapheme:body
+  }
   var c/eax: byte <- read-byte in
   var num-trailers/ecx: int <- copy 0
   $read-grapheme:compute-length: {