about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 30895b22..7328839a 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -526,7 +526,9 @@ proc putAtom(state: var LineBoxState; atom: InlineAtom;
 proc addSpacing(ictx: var InlineContext; width: LayoutUnit; state: InlineState;
     hang = false) =
   let fragment = ictx.whitespaceFragment
-  if fragment.state.atoms.len == 0 or fragment.state.atoms[^1].t != iatWord:
+  if fragment.state.atoms.len == 0 or ictx.lbstate.atoms.len == 0 or
+      (let oatom = fragment.state.atoms[^1];
+        oatom.t != iatWord or oatom != ictx.lbstate.atoms[^1]):
     let atom = InlineAtom(
       t: iatWord,
       size: size(w = 0, h = ictx.cellHeight),