From 2b0398c59bfb037582ce994c63b40ab6aee59bc0 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 16 Mar 2013 16:51:55 +0100 Subject: [PATCH] awful.tag: Use sane tag index values (FS#1125) Since commit d8a93dafa316d, tags have an "index" property which decides about the order in which they are displayed in the taglist. If a tag doesn't have this property set, the next call to awful.tag.gettags() will fix this and "invent" an index for this new tag. However, if multiple tags didn't have an "index" property, gettags() would assign all of them the same index. The following call to table.sort() would then do random magic to these tags (remember: table.sort() is not a stable sorting algorithm, so it is allowed to randomly swap around entries which have the same sorting key). Fix this by making sure that the new "index" properties are different from each other. Signed-off-by: Uli Schlachter --- lib/awful/tag.lua.in | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index cbaed182..c2cd1d32 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -256,6 +256,7 @@ function tag.gettags(s) for _, t in ipairs(tags) do if not tag.getproperty(t, "index") then tag.setproperty(t, "index", (#tags - without_index + 1)) + without_index = without_index - 1 end end end