Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions AceTab-3.0/AceTab-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- @name AceTab-3.0
-- @release $Id$

local ACETAB_MAJOR, ACETAB_MINOR = 'AceTab-3.0', 10
local ACETAB_MAJOR, ACETAB_MINOR = 'AceTab-3.0', 11
local AceTab, oldminor = LibStub:NewLibrary(ACETAB_MAJOR, ACETAB_MINOR)

if not AceTab then return end -- No upgrade needed
Expand Down Expand Up @@ -398,18 +398,21 @@ function AceTab:OnTabPressed(this)
allGCBS = gcbs(allGCBS, m)
end
else
-- The greatest common substring of the valid matches is what gets inserted into the
-- editbox below, so it is needed whether usage output is squelched (usagefunc == true)
-- or produced by a function. Compute it before the branch.
-- TODO: Make the GCBS function accept a vararg or table, after which we can just pass in the list of matches.
setGCBS = nil
for m in pairs(matches) do
setGCBS = gcbs(setGCBS, m)
end
allGCBS = gcbs(allGCBS, setGCBS)

-- Print a usage statement based on the corresponding registered usagefunc.
-- candUsage is the table passed to usagefunc to be filled with candidate = usage_statement pairs.
if type(usagefunc) == 'function' then
for i in pairs(candUsage) do candUsage[i] = nil end

-- usagefunc takes the greatest common substring of valid matches as one of its args, so let's find that now.
-- TODO: Make the GCBS function accept a vararg or table, after which we can just pass in the list of matches.
setGCBS = nil
for m in pairs(matches) do
setGCBS = gcbs(setGCBS, m)
end
allGCBS = gcbs(allGCBS, setGCBS)
usage = usagefunc(candUsage, matches, setGCBS, strsub(text_precursor, 1, prematchEnd))

-- If the usagefunc returns a string, then the entire usage statement has been taken care of by usagefunc, and we need only to print it...
Expand Down
Loading