widelands
widelands copied to clipboard
Richtext: A div tag with width < 100% messes up first list item
Mirrored from Codeberg
Created on Wed Nov 29 20:48:34 CET 2023 by frankystone
If you apply a width < 100% to a div, a following list item gets an additional line break. More following list items are shown correctly.
To reproduce
- Enter debug console and
include richtext.lua
- enter
wl.ui.show_messagebox("t",rt(div("width=50%", li("*", "first"))))
- result: An additional line break is made between the
*
and the text - enter
wl.ui.show_messagebox("t",rt(div("width=50%", li("*", "first") .. li("*", "second"))))
- result: The second list item is shown correct
If you specify the width of the div as 100% then all list items are shown correctly.
Expected behavior
The first list item should be shown as * first
Screenshots What i am trying is to achieve is a two columns layout. This works nicely with headers, normal paragraphs and text. Only the first list item has always a linebreak. But the example above shows the two columns layout is not the culprit.
Version:
- OS: archlinux
- Widelands Version: 1.2~git26380 (6712f0f@master) Debug
Additional context Maybe i am doing something wrong, but i have tried a lot of things, also to wrap two div's in another div with width of 100%. The problem persists.
Mirrored from Codeberg
On Thu Nov 30 08:44:00 CET 2023, ** (frankystone)* wrote:*
The resulting div-soup is for both (50% and 100%) the same:
<div width=50%>
<div>
<p>
<font face=sans size=12 color=ffff00>
*
</font>
<vspace gap=6>
</p>
</div>
<div>
<p>
<font face=sans size=12 color=ffff00>
<space gap=6>
</font>
<vspace gap=6>
</p>
</div>
<div width=*>
<p>
<font face=sans size=12 color=ffff00>
first
<vspace gap=6>
</font>
<vspace gap=6>
</p>
</div>
</div>
<div width=100%>
<div>
<p>
<font face=sans size=12 color=ffff00>
*
</font>
<vspace gap=6>
</p>
</div>
<div>
<p>
<font face=sans size=12 color=ffff00>
<space gap=6>
</font>
<vspace gap=6>
</p>
</div>
<div width=*>
<p>
<font face=sans size=12 color=ffff00>
first
<vspace gap=6>
</font>
<vspace gap=6>
</p>
</div>
</div>
Mirrored from Codeberg
On Thu Nov 30 09:13:20 CET 2023, ** (frankystone)* wrote:*
Two columns layout examples:
-
wl.ui.show_messagebox("t",rt(div("width=50%", p("left")) .. div("width=50% float=right", p("right"))))
works -
wl.ui.show_messagebox("t",rt(div("width=50%", li("*","left")) .. div("width=50% float=right", li("*","right"))))
the left list item has a linebreak, the right one is correct although the width is also 50%