Fix wibox.layout.stack:raise()

There seem to be two issues here. First, the if-statement at the
beginning of the function will return prematurely if
`self._private.widgets[index]` exists. There seems to be a
missing `not` there.
Second, index 1 is interpreted as the top of the stack (although the
documentation says otherwise), but the widget is inserted at the end of
`self._private.widgets`, so it gets pushed to the bottom
instead of the top.
This commit is contained in:
PlayerNameHere 2020-09-26 23:49:44 +08:00
parent ca29aa191f
commit 13e41a2a7b
1 changed files with 2 additions and 2 deletions

View File

@ -116,11 +116,11 @@ end
-- @method raise
-- @tparam number index the widget index to raise
function stack:raise(index)
if (not index) or self._private.widgets[index] then return end
if (not index) or (not self._private.widgets[index]) then return end
local w = self._private.widgets[index]
table.remove(self._private.widgets, index)
table.insert(self._private.widgets, w)
table.insert(self._private.widgets, 1, w)
self:emit_signal("widget::layout_changed")
end