diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-11-24 17:25:13 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-11-24 17:25:13 +0100 |
| commit | 02359c918d567529afcebbd9d0fc7bfb89f31cb9 (patch) | |
| tree | 5e32da42d27cc4619881994519486e98a8e2f190 /src | |
| parent | e10fab72faa22b1eb17206bc13cc518f9fde7c26 (diff) | |
| download | chawan-02359c918d567529afcebbd9d0fc7bfb89f31cb9.tar.gz | |
layout: another intrinsic min width fix
forgot about word-break
Diffstat (limited to 'src')
| -rw-r--r-- | src/css/layout.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim index b48bee57..6f91fada 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -673,14 +673,16 @@ proc addAtom(ictx: var InlineContext; state: var InlineState; ictx.addSpacing(shift, state) case atom.t of iatWord: + let wordBreak = state.fragment.computed{"word-break"} if ictx.wrappos != -1: # set xminwidth to the first wrapping opportunity ictx.state.xminwidth = max(ictx.state.xminwidth, ictx.wrappos) - elif state.prevrw == 2: + elif state.prevrw >= 2 and wordBreak != WordBreakKeepAll or + wordBreak == WordBreakBreakAll: # last char was double width; we can wrap anywhere. # (I think this isn't quite right when double width + half width # are mixed, but whatever...) - ictx.state.xminwidth = max(ictx.state.xminwidth, 2) + ictx.state.xminwidth = max(ictx.state.xminwidth, state.prevrw) else: ictx.state.xminwidth = max(ictx.state.xminwidth, atom.size.w) if ictx.lbstate.atoms.len > 0 and state.fragment.state.atoms.len > 0: |