about summary refs log tree commit diff stats
path: root/513grapheme-stack.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-29 22:16:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-29 22:20:09 -0700
commit6e05a8fa27139ddf75a029ad94d44b48a92785b2 (patch)
tree8d04ae5d057030246305c9dc4b46fb2fe176f643 /513grapheme-stack.mu
parent4b90a26d71513f3b908b7f7ec651996ddf6460d6 (diff)
downloadmu-6e05a8fa27139ddf75a029ad94d44b48a92785b2.tar.gz
fix bad terminology: grapheme -> code point
Unix text-mode terminals transparently support utf-8 these days, and so
I treat utf-8 sequences (which I call graphemes in Mu) as fundamental.

I then blindly carried over this state of affairs to bare-metal Mu,
where it makes no sense. If you don't have a terminal handling
font-rendering for you, fonts are most often indexed by code points and
not utf-8 sequences.
Diffstat (limited to '513grapheme-stack.mu')
-rw-r--r--513grapheme-stack.mu27
1 files changed, 21 insertions, 6 deletions
diff --git a/513grapheme-stack.mu b/513grapheme-stack.mu
index 2db873a0..40deb052 100644
--- a/513grapheme-stack.mu
+++ b/513grapheme-stack.mu
@@ -98,7 +98,12 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel
     compare i, *top-addr
     break-if->=
     {
-      var g/esi: (addr grapheme) <- index data, i
+      var c: code-point
+      {
+        var g/eax: (addr grapheme) <- index data, i
+        var tmp/eax: code-point <- to-code-point *g
+        copy-to c, tmp
+      }
       var fg: int
       {
         var tmp/eax: int <- copy color
@@ -109,7 +114,7 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel
         break-if-!=
         copy-to fg, 0xf/highlight
       }
-      x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color
+      x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, fg, background-color
     }
     i <- increment
     loop
@@ -152,8 +157,13 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self:
     break-if-=
     compare i, 0
     break-if-<
-    var g/esi: (addr grapheme) <- index data, i
-    x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, background-color, color
+    var c: code-point
+    {
+      var g/eax: (addr grapheme) <- index data, i
+      var tmp/eax: code-point <- to-code-point *g
+      copy-to c, tmp
+    }
+    x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, background-color, color
     i <- decrement
   }
   # remaining iterations
@@ -172,8 +182,13 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self:
       copy-to fg, 0xf/highlight
     }
     #
-    var g/esi: (addr grapheme) <- index data, i
-    x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color
+    var c: code-point
+    {
+      var g/eax: (addr grapheme) <- index data, i
+      var tmp/eax: code-point <- to-code-point *g
+      copy-to c, tmp
+    }
+    x, y <- render-code-point screen, c, xmin, ymin, xmax, ymax, x, y, fg, background-color
     i <- decrement
     loop
   }
Andinus <andinus@nand.sh> 2020-08-31 17:06:03 +0530 committer Andinus <andinus@nand.sh> 2020-08-31 17:06:03 +0530 Move configuration to a config file' href='/andinus/leo/commit/leo.pl?h=v0.5.0&id=4648948ddb3cc0a3f046df50cccfe74a2da2e6d1'>4648948 ^
cb14d4e ^
1e63070 ^
cb14d4e ^









fdc444f ^
cb14d4e ^




b64034d ^

cb14d4e ^
fdc444f ^
9e478c1 ^
fdc444f ^
9e478c1 ^
fdc444f ^
18c8216 ^
b99691c ^
cb14d4e ^
6dca06c ^
9e478c1 ^

fdc444f ^



9e478c1 ^
6dca06c ^
18c8216 ^


fdc444f ^
18c8216 ^

eeb6cb0 ^


18c8216 ^



18c8216 ^
61e44ee ^
4648948 ^
61e44ee ^


252af66 ^



299d5ee ^

61e44ee ^

9e478c1 ^
34857c3 ^
34857c3 ^
fdc444f ^
34857c3 ^
cb14d4e ^







34857c3 ^



18c8216 ^
299d5ee ^
4648948 ^
1e63070 ^

34857c3 ^

61c874b ^
18c8216 ^
61c874b ^














1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142