AceTab-2.0 Quickies

From WowAce Wiki
Jump to: navigation, search

These are simple AceTab-2.0 registrations to do useful things. Feel free to post your own!


Visor frame name completion

This will allow you to tab-complete frame names after f=, p=, and pr= when the ChatFrameEditBox text begins with /vz or /visor. It uses the default AceTab-2.0 usage statment feedback (the list of remaining potential completions is printed to the chat frame, with the description ("VisorFrames") as its header):

AceLibrary("AceTab-2.0"):RegisterTabCompletion("VisorFrames",
    {"^%/visor .*p=", "^%/visor .*pr=", "^%/visor .*f=", "^%/vz .*p=", "^%/vz .*pr=", "^%/vz .*f="},
    function (t, text)
        local f = EnumerateFrames()
        while f do
            table.insert(t, f:GetName())
            f = EnumerateFrames(f)
        end 
    end)

TinyPad word completion

This will allow you to tab-complete any word in the TinyPad frame when tab is pressed within the frame. Chat frame "usage" feedback is squelched:

AceLibrary("AceTab-2.0"):RegisterTabCompletion("TinyPad", "",
   function(t, text, pos)                                                                                       -- consider everything...
       for i in string.gfind(string.sub(text, 1, pos), "(%w+)") do                                              -- ...before the current "word"
           table.insert(t, i)
       end
       for i in string.gfind(string.sub(text, string.find(text, "%s", pos+1) or string.len(text)), "(%w+)") do  -- ...after the current "word"
           table.insert(t ,i)
       end
   end, true, TinyPadEditBox)

Teknicolor name completion

This will allow you to tab-complete any name that Teknicolor has picked up:

with formatted list of partial matches printed, colon appended to completion if this is the first word:

AceLibrary("AceTab-2.0"):RegisterTabCompletion("Teknicolor", "",
   function(t, text, pos)
       for name in pairs(Teknicolor.nametable) do
           table.insert(t, pos == 0 and name..":" or name)
       end
   end, function(u, cands)
       for _, cand in ipairs(cands) do
           print((string.gsub(Teknicolor.nametable[string.gsub(cand, ":", "")], "[%[%]]+", "")))
       end
   end)

slightly more complicated version of above; prints the potential names on one line

AceLibrary("AceTab-2.0"):RegisterTabCompletion("Teknicolor", "",
    function(t, text, pos)
        for name in pairs(Teknicolor.nametable) do
            table.insert(t, pos == 0 and name..":" or name)
        end
    end, function(u, cands)
        local n = compost and compost:Erase() or {}
            for _, cand in ipairs(cands) do
                table.insert(n, Teknicolor.nametable[string.gsub(cand, ":", "")])
            end
            if n[1] then
                print((string.gsub(table.concat(n), "[%[%]]+", " ")))
            end
    end)

no list of partial matches, no colon:

AceLibrary("AceTab-2.0"):RegisterTabCompletion("Teknicolor", "",
    function(t)
        for name in pairs(Teknicolor.nametable) do
            table.insert(t, name)
        end
    end, true)