From 0452b05f5a78b33d94352c676e021b4a1abfb5f2 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 2 Aug 2020 12:05:25 -0700 Subject: 6703 - new types: code-point and grapheme Both have the same size: 4 bytes. So far I've just renamed print-byte to print-grapheme, but it still behaves the same. I'm going to support printing code-points next, but grapheme 'clusters' spanning multiple code-points won't be supported for some time. --- prototypes/browse/20/file-state.mu | 3 ++- prototypes/browse/20/screen-position-state.mu | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'prototypes/browse/20') diff --git a/prototypes/browse/20/file-state.mu b/prototypes/browse/20/file-state.mu index 544c7832..d42bf8bf 100644 --- a/prototypes/browse/20/file-state.mu +++ b/prototypes/browse/20/file-state.mu @@ -39,6 +39,7 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte 0, c + var g/eax: grapheme <- copy c + print-grapheme 0, g loop } diff --git a/prototypes/browse/20/screen-position-state.mu b/prototypes/browse/20/screen-position-state.mu index 41ad2705..2f61f3e7 100644 --- a/prototypes/browse/20/screen-position-state.mu +++ b/prototypes/browse/20/screen-position-state.mu @@ -71,7 +71,8 @@ $add-char:body: { break $add-char:body } # print c - print-byte 0, c + var g/eax: grapheme <- copy c + print-grapheme 0, g # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp -- cgit 1.4.1-2-gfad0 href='/akkartik/mu/log/prototypes/browse/20/screen-position-state.mu?h=main'>log tree commit diff stats
path: root/prototypes/browse/20/screen-position-state.mu
blob: 124505cb16bd23cdf05805b12d44b73919de98a0 (plain) (blame)
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
143
144