diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/layout/engine.nim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index adf691ef..6236825d 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -76,9 +76,17 @@ func cellheight(viewport: Viewport): LayoutUnit = func cellheight(ictx: InlineContext): LayoutUnit = ictx.viewport.cellheight +# Check if the last atom on the current line is a spacing atom, not counting +# padding atoms. func hasLastSpacing(ictx: InlineContext): bool = - return ictx.currentLine.atoms[^1] of InlineSpacing and - not (ictx.currentLine.atoms[^1] of InlinePadding) + for i in countdown(ictx.currentLine.atoms.high, 0): + if ictx.currentLine.atoms[i] of InlineSpacing: + if ictx.currentLine.atoms[i] of InlinePadding: + continue # skip padding + return true + else: + break + return false # Whitespace between words func computeShift(ictx: InlineContext, computed: CSSComputedValues): |