about summary refs log tree commit diff stats
path: root/src/layout
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
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')
-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)