about summary refs log tree commit diff stats
path: root/src/layout/engine.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/engine.nim')
-rw-r--r--src/layout/engine.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 28ade1c5..4c56ffd9 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -469,6 +469,10 @@ proc addSpacing(ictx: var InlineContext, width, height: LayoutUnit,
     ictx.currentLine.size.w += width
   ictx.currentLine.atomstates.add(iastate)
   ictx.currentLine.atoms.add(spacing)
+  # whitespaceFragment's endOffset may already be set, in this case we must
+  # shift it by width.
+  # (If it is not set, then it will simply be overridden when endOffset is set.)
+  ictx.whitespaceFragment.endOffset.x += width
   ictx.whitespaceFragment.atoms.add(spacing)
 
 proc flushWhitespace(ictx: var InlineContext, state: InlineState,