about summary refs log tree commit diff stats
path: root/src/layout/engine.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-05 04:55:05 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-05 04:55:05 +0100
commite6c975ba2063c51c60829d0dad4aad10832bd926 (patch)
treeda1f032ce2ca123db556d6a7e8b514756730f38c /src/layout/engine.nim
parenta16e3575c858822b2b7b09a746a84dcf282ef259 (diff)
downloadchawan-e6c975ba2063c51c60829d0dad4aad10832bd926.tar.gz
layout/engine: fix pre-line wrap on newline
Just how many white-space properties can I get wrong?
Diffstat (limited to 'src/layout/engine.nim')
-rw-r--r--src/layout/engine.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 48b99d36..908f6671 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -326,8 +326,13 @@ proc checkWrap(state: var InlineState, r: Rune) =
 proc processWhitespace(state: var InlineState, c: char) =
   state.addWord()
   case state.computed{"white-space"}
-  of WHITESPACE_NORMAL, WHITESPACE_NOWRAP, WHITESPACE_PRE_LINE:
+  of WHITESPACE_NORMAL, WHITESPACE_NOWRAP:
     state.ictx.whitespacenum = max(state.ictx.whitespacenum, 1)
+  of WHITESPACE_PRE_LINE:
+    if c == '\n':
+      state.ictx.flushLine(state.computed)
+    else:
+      state.ictx.whitespacenum = max(state.ictx.whitespacenum, 1)
   of WHITESPACE_PRE, WHITESPACE_PRE_WRAP:
     if c == '\n':
       state.ictx.flushLine(state.computed)
250 ^
32b8fac2 ^
f344b250 ^
32b8fac2 ^
f344b250 ^
32b8fac2 ^
f344b250 ^
32b8fac2 ^




f344b250 ^
32b8fac2 ^


cd9bb850 ^







32b8fac2 ^





cd9bb850 ^

32b8fac2 ^
cd9bb850 ^
32b8fac2 ^








f344b250 ^

32b8fac2 ^


2f02189d ^
f344b250 ^
32b8fac2 ^
f344b250 ^
32b8fac2 ^



f344b250 ^

32b8fac2 ^




f344b250 ^

32b8fac2 ^


298f8065 ^

f344b250 ^

298f8065 ^



f344b250 ^
298f8065 ^

32b8fac2 ^

cd9bb850 ^
32b8fac2 ^
f344b250 ^

32b8fac2 ^
cd9bb850 ^

32b8fac2 ^














f344b250 ^
32b8fac2 ^
cd9bb850 ^
32b8fac2 ^











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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177