Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 7895f091aab89dfa794b86d229850b930ed0bd2e
- Author: Emmanuel Lepage Vallee <[email protected]>
- Date: Wed May 28 00:46:17 2014 -0400
- Fix flawed tag deletion logic (FS#1268)
- The sticky use case was dubious as if there is no fallback tag,
- the process abort early. Then, the new selected tag doesn't have
- to be random, as the fallback is always a better choice.
- Finally, this fix an issue where clients with multiple tags were
- simply not supported. It is a very useful feature if used with
- some implementation of tag forking. The current implementation
- caused the client to be untagged from all other tags. As the
- fallback tag is designed to avoid a client having no tags, it is
- not needed (nor wanted) in that case.
- diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
- index 58b0a34..40a5bc0 100644
- --- a/lib/awful/tag.lua.in
- +++ b/lib/awful/tag.lua.in
- @@ -139,14 +139,19 @@ function tag.delete(target_tag, fallback_tag)
- local clients = target_tag:clients()
- if ( #clients > 0 and ntags <= 1 ) or fallback_tag == nil then return end
- + -- Keep a possible candidate in case no selected tag is available
- + -- it is very rare, but possible if a client have been automatically tagged
- + local candidate = fallback_tag
- +
- -- Move the clients we can off of this tag.
- for _, c in pairs(clients) do
- + local current_tags = c:tags()
- - -- If a client has only this tag, or stickied clients with
- - -- nowhere to go, abort.
- - if (not c.sticky and #c:tags() == 1) or
- - (c.sticky and fallback_tag == nil) then
- - return
- + -- Do not use a "random" tags as fallback if the client already have some
- + if #current_tags > 1 then
- + current_tags[util.table.hasitem(current_tags,target_tag)] = nil
- + c:tags(current_tags)
- + candidate = current_tags[1]
- else
- c:tags({fallback_tag})
- end
- @@ -160,7 +165,8 @@ function tag.delete(target_tag, fallback_tag)
- if tag.selected(target_scr) == nil and ntags > 0 then
- tag.history.restore(nil, 1)
- if tag.selected(target_scr) == nil then
- - tag.gettags(target_scr)[1].selected = true
- + local next_tag = candidate or tag.gettags(target_scr)[1]
- + next_tag.selected = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement