diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-02 13:23:18 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-02 13:23:18 +0100 |
commit | 2d32034863eaaf9d8dfe359f11f4f17f097e271f (patch) | |
tree | 625f7b667db9ca7c45842a4ab42690a1c9806248 /src/layout | |
parent | ce95d6c7648c17885daba80b042b36d800e89b34 (diff) | |
download | chawan-2d32034863eaaf9d8dfe359f11f4f17f097e271f.tar.gz |
layout: add whitespace width to end offset's x position
so that e.g. a<span style="background-color: red"> </span>b makes the span width exactly one space.
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/engine.nim | 4 |
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, |