You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When you set a Width on a style, that should encompass the entire styled block. Currently, it will not factor in the border size here, so if a border is set, the actual rendered width is off by 2. This also means that the wrapped text is off by 2 as well.
To Reproduce
Add this to styles_test.go (or any other test file in the repo)
funcTestWidth(t*testing.T) {
width, _, _:=term.GetSize(os.Stdout.Fd())
content:="The Romans learned from the Greeks that quinces slowly cooked with honey would “set” when cool. The Apicius gives a recipe for preserving whole quinces, stems and leaves attached, in a bath of honey diluted with defrutum: Roman marmalade. Preserves of quince and lemon appear (along with rose, apple, plum and pear) in the Book of ceremonies of the Byzantine Emperor Constantine VII Porphyrogennetos."style:=NewStyle().Padding(0, 2).Border(NormalBorder(), true)
t.Log(width)
t.Log(style.GetHorizontalFrameSize())
contentWidth:=width-style.GetHorizontalFrameSize()
t.Log(contentWidth)
rendered:=style.Width(contentWidth).Render(content)
t.Log(Width(rendered))
}
You'll see that contentWidth != Width(rendered)
Expected behavior contentWidth and Width(rendered) should be the same
Notes
Should also check this is working for Height...
The text was updated successfully, but these errors were encountered:
Describe the bug
When you set a
Width
on a style, that should encompass the entire styled block. Currently, it will not factor in the border size here, so if a border is set, the actual rendered width is off by 2. This also means that the wrapped text is off by 2 as well.To Reproduce
Add this to
styles_test.go
(or any other test file in the repo)You'll see that
contentWidth != Width(rendered)
Expected behavior
contentWidth
andWidth(rendered)
should be the sameNotes
Should also check this is working for
Height
...The text was updated successfully, but these errors were encountered: