wibox.widget.textbox: return 0, 0 from fit() if either w or h is 0
A hack around abusing the fact that width of a textbox is 0 when its empty, while it's height is still set according to the font. Signed-off-by: Lukáš Hrázký <lukkash@email.cz> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
1881ceb9d3
commit
470142acc3
|
@ -45,6 +45,11 @@ end
|
||||||
function textbox:fit(width, height)
|
function textbox:fit(width, height)
|
||||||
setup_layout(self, width, height)
|
setup_layout(self, width, height)
|
||||||
local ink, logical = self._layout:get_pixel_extents()
|
local ink, logical = self._layout:get_pixel_extents()
|
||||||
|
|
||||||
|
if logical.width == 0 or logical.height == 0 then
|
||||||
|
return 0, 0
|
||||||
|
end
|
||||||
|
|
||||||
return logical.width, logical.height
|
return logical.width, logical.height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue