tag: Fix :delete() when there is no clients
The logic was broken. It prevented tags from being deleted. This also make sure the boolean return value is always set.
This commit is contained in:
parent
d2988d1aab
commit
2af0553b67
|
@ -259,15 +259,14 @@ end
|
||||||
-- stickied tags to.
|
-- stickied tags to.
|
||||||
-- @tparam[opt=false] boolean force Move even non-sticky clients to the fallback
|
-- @tparam[opt=false] boolean force Move even non-sticky clients to the fallback
|
||||||
-- tag.
|
-- tag.
|
||||||
-- @return Returns true if the tag is successfully deleted, nil otherwise.
|
-- @return Returns true if the tag is successfully deleted.
|
||||||
-- If there are no clients exclusively on this tag then delete it. Any
|
-- If there are no clients exclusively on this tag then delete it. Any
|
||||||
-- stickied clients are assigned to the optional 'fallback_tag'.
|
-- stickied clients are assigned to the optional 'fallback_tag'.
|
||||||
-- If after deleting the tag there is no selected tag, try and restore from
|
-- If after deleting the tag there is no selected tag, try and restore from
|
||||||
-- history or select the first tag on the screen.
|
-- history or select the first tag on the screen.
|
||||||
function tag.object.delete(self, fallback_tag, force)
|
function tag.object.delete(self, fallback_tag, force)
|
||||||
|
|
||||||
-- abort if the taf isn't currently activated
|
-- abort if the taf isn't currently activated
|
||||||
if not self.activated then return end
|
if not self.activated then return false end
|
||||||
|
|
||||||
local target_scr = get_screen(tag.getproperty(self, "screen"))
|
local target_scr = get_screen(tag.getproperty(self, "screen"))
|
||||||
local tags = target_scr.tags
|
local tags = target_scr.tags
|
||||||
|
@ -275,7 +274,7 @@ function tag.object.delete(self, fallback_tag, force)
|
||||||
local ntags = #tags
|
local ntags = #tags
|
||||||
|
|
||||||
-- We can't use the target tag as a fallback.
|
-- We can't use the target tag as a fallback.
|
||||||
if fallback_tag == self then return end
|
if fallback_tag == self then return false end
|
||||||
|
|
||||||
-- No fallback_tag provided, try and get one.
|
-- No fallback_tag provided, try and get one.
|
||||||
if fallback_tag == nil then
|
if fallback_tag == nil then
|
||||||
|
@ -284,7 +283,7 @@ function tag.object.delete(self, fallback_tag, force)
|
||||||
|
|
||||||
-- Abort if we would have un-tagged clients.
|
-- Abort if we would have un-tagged clients.
|
||||||
local clients = self:clients()
|
local clients = self:clients()
|
||||||
if ( #clients > 0 and ntags <= 1 ) or fallback_tag == nil then return end
|
if #clients > 0 and fallback_tag == nil then return false end
|
||||||
|
|
||||||
-- Move the clients we can off of this tag.
|
-- Move the clients we can off of this tag.
|
||||||
for _, c in pairs(clients) do
|
for _, c in pairs(clients) do
|
||||||
|
|
Loading…
Reference in New Issue