diff options
author | bptato <nincsnevem662@gmail.com> | 2023-07-28 00:13:07 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-07-28 01:00:12 +0200 |
commit | 4f64400ec3f2928b72085750d07a5ac5b6acdb50 (patch) | |
tree | 6fafed9aff3e937feec517dc32d6e2756a237499 /src | |
parent | ec37eee0d637cc36347cc1e6093c0027f80bdcc1 (diff) | |
download | chawan-4f64400ec3f2928b72085750d07a5ac5b6acdb50.tar.gz |
layout: count spacing before inline padding too
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): |