Skip to content

Commit

Permalink
Fix empty groups never being visible
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Sep 2, 2022
1 parent fcbe350 commit dd0c2b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format of this changelog is based on [Keep a Changelog](https://keepachangel

* Fix keybinds being active while in a vehicle on WOTLK
* Fix WOTLK-specific features not working due to Blizzard code change
* Fix empty groups not being visible with an empty search term

## [1.7.6] - 2022-08-31

Expand Down
32 changes: 12 additions & 20 deletions Clicked/Widgets/AceGUIContainer-ClickedTreeGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,6 @@ local function UpdateButton(button, treeline, selected, canExpand, isExpanded)
end
end

local function ShouldDisplayLevel(tree)
local result = false
for _, v in ipairs(tree) do
if v.children == nil and v.visible ~= false then
result = true
elseif v.children then
result = result or ShouldDisplayLevel(v.children)
end
if result then return result end
end
return false
end

local function addLine(self, v, tree, level, parent)
local line = new()
line.value = v.value
Expand Down Expand Up @@ -913,11 +900,10 @@ function Methods:BuildLevel(tree, level, parent)
for _, v in ipairs(tree) do
if v.visible then
if v.children then
if ShouldDisplayLevel(v.children) then
local line = addLine(self, v, tree, level, parent)
if groups[line.uniquevalue] then
self:BuildLevel(v.children, level+1, line)
end
local line = addLine(self, v, tree, level, parent)

if groups[line.uniquevalue] then
self:BuildLevel(v.children, level+1, line)
end
else
addLine(self, v, tree, level, parent)
Expand All @@ -943,8 +929,14 @@ function Methods:BuildCache()
SetVisibleRecursive(next)
end
else
for i = 1, #next.children do
table.insert(open, next.children[i])
if #next.children == 0 then
if Addon:IsStringNilOrEmpty(self.searchbar.searchTerm) then
SetVisibleRecursive(next)
end
else
for i = 1, #next.children do
table.insert(open, next.children[i])
end
end
end
end
Expand Down

0 comments on commit dd0c2b5

Please sign in to comment.