tag: Fix index when screen count change.

There was still a problem that caused the "old" tags to be
inserted in the wrong position when "saved" from a screen being
removed.

Also, this use a :get_tags(true) to save an uneeded sorting pass.
This commit is contained in:
Emmanuel Lepage Vallee 2016-08-28 16:35:47 -04:00
parent 1be737be3a
commit d2988d1aab
1 changed files with 3 additions and 4 deletions

View File

@ -465,6 +465,7 @@ function tag.object.set_screen(t, s)
-- Change the screen
tag.setproperty(t, "screen", s)
tag.setproperty(t, "index", #s:get_tags(true))
-- Make sure the client's screen matches its tags
for _,c in ipairs(t:clients()) do
@ -473,11 +474,9 @@ function tag.object.set_screen(t, s)
end
-- Update all indexes
for _,screen in ipairs {old_screen, s} do
for i,t2 in ipairs(screen.tags) do
for i,t2 in ipairs(old_screen.tags) do
tag.setproperty(t2, "index", i)
end
end
-- Restore the old screen history if the tag was selected
if sel then