Global convert indentation to tabs

This commit is contained in:
Logan Payton
2018-05-18 00:28:38 -04:00
parent 1294e1d2c7
commit bc9b5f509e
8 changed files with 141 additions and 141 deletions
+47 -47
View File
@@ -16,7 +16,7 @@ local byte = string.byte
local LibBase64 = LibStub:NewLibrary("LibBase64-1.0", 1)
if not LibBase64 then
return
return
end
local _chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
@@ -25,12 +25,12 @@ local byteToNum = {}
local numToChar = {}
for i = 1, strlen(_chars) do
charTable[i] = sub(_chars, i, i)
charTable[i] = sub(_chars, i, i)
end
for i = 1, getn(charTable) do
numToChar[i - 1] = sub(_chars, i, i)
byteToNum[byte(_chars, i)] = i - 1
numToChar[i - 1] = sub(_chars, i, i)
byteToNum[byte(_chars, i)] = i - 1
end
_chars = nil
@@ -45,10 +45,10 @@ local plus_byte = byte("+")
local slash_byte = byte("/")
local equals_byte = byte("=")
local whitespace = {
[byte(" ")] = true,
[byte("\t")] = true,
[byte("\n")] = true,
[byte("\r")] = true,
[byte(" ")] = true,
[byte("\t")] = true,
[byte("\n")] = true,
[byte("\r")] = true,
}
local t = {}
@@ -60,27 +60,27 @@ local t = {}
-- @usage LibBase64.Encode("Hello, how are you doing today?") == "SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw=="
-- @return a Base64-encoded string
function LibBase64:Encode(text, maxLineLength, lineEnding)
if type(text) ~= "string" then
error(format("Bad argument #1 to `Encode'. Expected %q, got %q", "string", type(text)), 2)
end
if type(text) ~= "string" then
error(format("Bad argument #1 to `Encode'. Expected %q, got %q", "string", type(text)), 2)
end
if maxLineLength == nil then
-- do nothing
elseif type(maxLineLength) ~= "number" then
error(format("Bad argument #2 to `Encode'. Expected %q or %q, got %q", "number", "nil", type(maxLineLength)), 2)
elseif modf(maxLineLength, 4) ~= 0 then
error(format("Bad argument #2 to `Encode'. Expected a multiple of 4, got %s", maxLineLength), 2)
elseif maxLineLength <= 0 then
error(format("Bad argument #2 to `Encode'. Expected a number > 0, got %s", maxLineLength), 2)
end
if maxLineLength == nil then
-- do nothing
elseif type(maxLineLength) ~= "number" then
error(format("Bad argument #2 to `Encode'. Expected %q or %q, got %q", "number", "nil", type(maxLineLength)), 2)
elseif modf(maxLineLength, 4) ~= 0 then
error(format("Bad argument #2 to `Encode'. Expected a multiple of 4, got %s", maxLineLength), 2)
elseif maxLineLength <= 0 then
error(format("Bad argument #2 to `Encode'. Expected a number > 0, got %s", maxLineLength), 2)
end
if lineEnding == nil then
lineEnding = "\r\n"
elseif type(lineEnding) ~= "string" then
error(format("Bad argument #3 to `Encode'. Expected %q, got %q", "string", type(lineEnding)), 2)
end
if lineEnding == nil then
lineEnding = "\r\n"
elseif type(lineEnding) ~= "string" then
error(format("Bad argument #3 to `Encode'. Expected %q, got %q", "string", type(lineEnding)), 2)
end
local currentLength = 0
local currentLength = 0
for i = 1, getn(text), 3 do
local a, b, c = byte(text, i, i+2)
@@ -116,7 +116,7 @@ function LibBase64:Encode(text, maxLineLength, lineEnding)
currentLength = currentLength + 4
if maxLineLength and modf(currentLength, maxLineLength) == 0 then
t[getn(t)+1] = lineEnding
t[getn(t)+1] = lineEnding
end
end
@@ -136,29 +136,29 @@ local t2 = {}
-- @usage LibBase64.Encode("SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw==") == "Hello, how are you doing today?"
-- @return a bytestring
function LibBase64:Decode(text)
if type(text) ~= "string" then
error(format("Bad argument #1 to `Decode'. Expected %q, got %q", "string", type(text)), 2)
end
if type(text) ~= "string" then
error(format("Bad argument #1 to `Decode'. Expected %q, got %q", "string", type(text)), 2)
end
for i = 1, getn(text) do
local byte = byte(text, i)
if whitespace[byte] or byte == equals_byte then
-- do nothing
else
local num = byteToNum[byte]
if not num then
for i = 1, getn(t2) do
t2[k] = nil
end
for i = 1, getn(text) do
local byte = byte(text, i)
if whitespace[byte] or byte == equals_byte then
-- do nothing
else
local num = byteToNum[byte]
if not num then
for i = 1, getn(t2) do
t2[k] = nil
end
error(format("Bad argument #1 to `Decode'. Received an invalid char: %q", sub(text, i, i)), 2)
end
t2[getn(t2)+1] = num
end
end
error(format("Bad argument #1 to `Decode'. Received an invalid char: %q", sub(text, i, i)), 2)
end
t2[getn(t2)+1] = num
end
end
for i = 1, getn(t2), 4 do
local a, b, c, d = t2[i], t2[i+1], t2[i+2], t2[i+3]
for i = 1, getn(t2), 4 do
local a, b, c, d = t2[i], t2[i+1], t2[i+2], t2[i+3]
local nilNum = 0
if not c then
+5 -5
View File
@@ -137,7 +137,7 @@ function LibCompress:TableToString(t)
if t == nil then return nil end
if type(t)=="string" then return t end
local cache={}
local function sub_mod(t)
local function sub_mod(t)
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
@@ -153,8 +153,8 @@ function LibCompress:TableToString(t)
else
table_insert(cache, tostring(t))
end
end
sub_mod(t)
end
sub_mod(t)
return table_concat(cache, ",") -- ? maybe use a different delimiter
end
@@ -784,10 +784,10 @@ function LibCompress:Compress(data)
n = compression_methods[method](self, data)
nTable = {}
for i = 1, strlen(n) do
nTable[i] = string.sub(n, i, i)
nTable[i] = string.sub(n, i, i)
end
for i = 1, strlen(result) do
rTable[i] = string.sub(result, i, i)
rTable[i] = string.sub(result, i, i)
end
if getn(nTable) < getn(rTable) then
result = nTable
@@ -39,7 +39,7 @@ end
function Lib:MatchAll(search)
for phrase in gmatch(self:Clean(search), '[^&]+') do
if not self:MatchAny(phrase) then
return
return
end
end
@@ -49,7 +49,7 @@ end
function Lib:MatchAny(search)
for phrase in gmatch(search, '[^|]+') do
if self:Match(phrase) then
return true
return true
end
end
end
@@ -161,10 +161,10 @@ local escapes = {
}
local function CleanString(str)
for k, v in pairs(escapes) do
str = string.gsub(str, k, v)
end
return str
for k, v in pairs(escapes) do
str = string.gsub(str, k, v)
end
return str
end
Lib.Filters.tipPhrases = {
@@ -203,9 +203,9 @@ Lib.Filters.tipPhrases = {
cache = setmetatable({}, {__index = function(t, k) local v = {} t[k] = v return v end}),
keywords = {
[lower(ITEM_SOULBOUND)] = ITEM_BIND_ON_PICKUP,
["bound"] = ITEM_BIND_ON_PICKUP,
["bop"] = ITEM_BIND_ON_PICKUP,
[lower(ITEM_SOULBOUND)] = ITEM_BIND_ON_PICKUP,
["bound"] = ITEM_BIND_ON_PICKUP,
["bop"] = ITEM_BIND_ON_PICKUP,
["boe"] = ITEM_BIND_ON_EQUIP,
["bou"] = ITEM_BIND_ON_USE
}
@@ -232,8 +232,8 @@ function L_UIDropDownMenu_CreateFrames(level, index)
newList:SetWidth(180)
newList:SetHeight(10)
--Allow closing with escape
tinsert(UIMenus, "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS)
--Allow closing with escape
tinsert(UIMenus, "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS)
for i=L_UIDROPDOWNMENU_MINBUTTONS+1, L_UIDROPDOWNMENU_MAXBUTTONS do
local newButton = CreateFrame("Button", "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS.."Button"..i, newList, "L_UIDropDownMenuButtonTemplate");
+64 -64
View File
@@ -139,9 +139,9 @@ local queue_quiet = {
lib['WHOLIB_FLAG_ALWAYS_CALLBACK'] = 1
function lib:Reset()
self.Queue = {[1]={}, [2]={}, [3]={}}
self.Cache = {}
self.CacheQueue = {}
self.Queue = {[1]={}, [2]={}, [3]={}}
self.Cache = {}
self.CacheQueue = {}
end
function lib.Who(defhandler, query, opts)
@@ -169,10 +169,10 @@ function lib.UserInfo(defhandler, name, opts)
local self, args, usage = lib, {}, 'UserInfo(name, [opts])'
local now = time()
name = self:CheckArgument(usage, 'name', 'string', name)
if strlen(name) == 0 then return end
name = self:CheckArgument(usage, 'name', 'string', name)
if strlen(name) == 0 then return end
if string.find(name, "%-") then --[[dbg("ignoring xrealm: "..name)]] return end
if string.find(name, "%-") then --[[dbg("ignoring xrealm: "..name)]] return end
args.name = self:CapitalizeInitial(name)
opts = self:CheckArgument(usage, 'opts', 'table', opts, {})
@@ -218,27 +218,27 @@ function lib.UserInfo(defhandler, name, opts)
return nil
end
if (GetLocale() == "ruRU") then -- in ruRU with n- not show information about player in WIM addon
if args.name and strlen(args.name) > 0 then
local query = 'и-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
if args.name and strlen(args.name) > 0 then
local query = 'и-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
else
if args.name and strlen(args.name) > 0 then
local query = 'n-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
if args.name and strlen(args.name) > 0 then
local query = 'n-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
end
return nil
end
@@ -256,11 +256,11 @@ function lib.CachedUserInfo(_, name)
end
function lib.GetWhoLibDebug(_, mode)
return lib.Debug
return lib.Debug
end
function lib.SetWhoLibDebug(_, mode)
lib.Debug = mode
lib.Debug = mode
dbg = mode and dbgfunc or NOP
end
@@ -298,12 +298,12 @@ end
---
function lib:AllQueuesEmpty()
local queueCount = getn(self.Queue[1]) + getn(self.Queue[2]) + getn(self.Queue[3]) + getn(self.CacheQueue)
local queueCount = getn(self.Queue[1]) + getn(self.Queue[2]) + getn(self.Queue[3]) + getn(self.CacheQueue)
-- Be sure that we have cleared the in-progress status
if self.WhoInProgress then
queueCount = queueCount + 1
end
-- Be sure that we have cleared the in-progress status
if self.WhoInProgress then
queueCount = queueCount + 1
end
return queueCount == 0
end
@@ -344,19 +344,19 @@ local INSTANT_QUERY_MIN_INTERVAL = 60 -- only once every 1 min
function lib:UpdateWeights()
local weightsum, sum, count = 0, 0, 0
for k,v in pairs(queue_weights) do
sum = sum + v
weightsum = weightsum + v * getn(self.Queue[k])
sum = sum + v
weightsum = weightsum + v * getn(self.Queue[k])
end
if weightsum == 0 then
for k,v in pairs(queue_weights) do queue_bounds[k] = v end
return
for k,v in pairs(queue_weights) do queue_bounds[k] = v end
return
end
local adjust = sum / weightsum
for k,v in pairs(queue_bounds) do
queue_bounds[k] = queue_weights[k] * adjust * getn(self.Queue[k])
queue_bounds[k] = queue_weights[k] * adjust * getn(self.Queue[k])
end
end
@@ -376,17 +376,17 @@ function lib:GetNextFromScheduler()
local n,i = math.random(),0
repeat
i=i+1
n = n - queue_bounds[i]
i=i+1
n = n - queue_bounds[i]
until i >= getn(self.Queue) or n <= 0
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
if getn(self.Queue[i]) > 0 then
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
return i, self.Queue[i]
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
return i, self.Queue[i]
else
dbg("Queues empty, waiting")
dbg("Queues empty, waiting")
end
end
@@ -424,10 +424,10 @@ function lib:AskWhoNext()
self.WhoInProgress = false
local v,k,args = nil
local kludge = 10
local kludge = 10
repeat
k, v = self:GetNextFromScheduler()
if not k then break end
k, v = self:GetNextFromScheduler()
if not k then break end
if WhoFrame:IsShown() and k > self.WHOLIB_QUEUE_QUIET then
break
end
@@ -435,7 +435,7 @@ function lib:AskWhoNext()
args = tremove(v, 1)
break
end
kludge = kludge - 1
kludge = kludge - 1
until kludge <= 0
if args then
@@ -453,9 +453,9 @@ function lib:AskWhoNext()
self.Quiet = false
if args.whotoui then
-- self.hooked.SetWhoToUI(args.whotoui)
else
-- self.hooked.SetWhoToUI(args.gui and true or false)
-- self.hooked.SetWhoToUI(args.whotoui)
else
-- self.hooked.SetWhoToUI(args.gui and true or false)
end
else
-- self.hooked.SetWhoToUI(true)
@@ -469,11 +469,11 @@ function lib:AskWhoNext()
self.WhoInProgress = false
end
-- Keep processing the who queue if there is more work
-- Keep processing the who queue if there is more work
if not self:AllQueuesEmpty() then
self:AskWhoNextIn5sec()
else
dbg("*** Done processing requests ***")
else
dbg("*** Done processing requests ***")
end
end
@@ -486,10 +486,10 @@ function lib:AskWho(args)
end
function lib:ReturnWho()
if not self.Args then
self.Quiet = nil
return
end
if not self.Args then
self.Quiet = nil
return
end
if(self.Args.queue == self.WHOLIB_QUEUE_QUIET or self.Args.queue == self.WHOLIB_QUEUE_SCANNING)then
self.Quiet = nil
@@ -723,7 +723,7 @@ end
local MULTIBYTE_FIRST_CHAR = "^([\192-\255]?%a?[\128-\191]*)"
function lib:CapitalizeInitial(name)
return string.gsub(name, MULTIBYTE_FIRST_CHAR, string.upper, 1)
return string.gsub(name, MULTIBYTE_FIRST_CHAR, string.upper, 1)
end
---
@@ -736,7 +736,7 @@ lib.PossibleEvents = {
}
function lib:TriggerEvent(...)
callbacks:Fire(event, unpack(arg))
callbacks:Fire(event, unpack(arg))
end
---
@@ -761,7 +761,7 @@ SlashCmdList['WHOLIB_DEBUG'] = function()
-- /wholibdebug: toggle debug on/off
local self = lib
self:SetWhoLibDebug(not self.Debug)
self:SetWhoLibDebug(not self.Debug)
end
SLASH_WHOLIB_DEBUG1 = '/wholibdebug'
@@ -889,12 +889,12 @@ end
FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE")
function lib:WHO_LIST_UPDATE()
if not lib.Quiet then
if not lib.Quiet then
WhoList_Update()
FriendsFrame_Update()
end
FriendsFrame_Update()
end
lib:ProcessWhoResults()
lib:ProcessWhoResults()
end
function lib:ProcessWhoResults()
+9 -9
View File
@@ -28,7 +28,7 @@ local bind = CreateFrame("Frame", "ElvUI_KeyBinder", E.UIParent)
function AB:ActivateBindMode()
bind.active = true
E:StaticPopupSpecial_Show(ElvUIBindPopupWindow)
E:StaticPopupSpecial_Show(ElvUIBindPopupWindow)
AB:RegisterEvent("PLAYER_REGEN_DISABLED", "DeactivateBindMode", false)
end
@@ -265,7 +265,7 @@ function AB:LoadKeyBinder()
for b, _ in pairs(self["handledButtons"]) do
self:RegisterButton(b, true)
end
end
if not IsAddOnLoaded("Blizzard_MacroUI") then
self:SecureHook("LoadAddOn", "RegisterMacro")
@@ -282,11 +282,11 @@ function AB:LoadKeyBinder()
f:SetFrameLevel(99)
f:SetClampedToScreen(true)
E:Size(f, 360, 130)
E:SetTemplate(f, "Transparent")
E:SetTemplate(f, "Transparent")
f:Hide()
local header = CreateFrame("Button", nil, f)
E:SetTemplate(header, "Default", true)
local header = CreateFrame("Button", nil, f)
E:SetTemplate(header, "Default", true)
E:Size(header, 100, 25)
E:Point(header, "CENTER", f, "TOP")
header:SetFrameLevel(header:GetFrameLevel() + 2)
@@ -295,8 +295,8 @@ function AB:LoadKeyBinder()
header:SetScript("OnMouseDown", function() f:StartMoving() end)
header:SetScript("OnMouseUp", function() f:StopMovingOrSizing() end)
local title = header:CreateFontString("OVERLAY")
E:FontTemplate(title)
local title = header:CreateFontString("OVERLAY")
E:FontTemplate(title)
E:Point(title, "CENTER", header, "CENTER")
title:SetText("Key Binds")
@@ -311,8 +311,8 @@ function AB:LoadKeyBinder()
local perCharCheck = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
_G[perCharCheck:GetName() .. "Text"]:SetText(CHARACTER_SPECIFIC_KEYBINDINGS)
perCharCheck:SetScript("OnShow", function()
perCharCheck:SetChecked(GetCurrentBindingSet() == 2)
perCharCheck:SetScript("OnShow", function()
perCharCheck:SetChecked(GetCurrentBindingSet() == 2)
end)
perCharCheck:SetScript("OnClick", function()
+5 -5
View File
@@ -185,11 +185,11 @@ function AFK:OnEvent(event, ...)
if not E.db.general.afk then return end
if UnitAffectingCombat("player") or CinematicFrame:IsShown() then return end
-- if UnitCastingInfo("player") ~= nil then
-- --Don't activate afk if player is crafting stuff, check back in 30 seconds
-- self:ScheduleTimer("OnEvent", 30)
-- return
-- end
-- if UnitCastingInfo("player") ~= nil then
-- --Don't activate afk if player is crafting stuff, check back in 30 seconds
-- self:ScheduleTimer("OnEvent", 30)
-- return
-- end
if arg1 == format(MARKED_AFK_MESSAGE, DEFAULT_AFK_MESSAGE) then
self:SetAFK(true)