Skip to content

Commit

Permalink
- only set config value by TextEdit if text has changed
Browse files Browse the repository at this point in the history
- colored mod name in chat messages
  • Loading branch information
frozn committed May 25, 2024
1 parent a95e299 commit be96cbe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions TipTacOptions/Libs/AzOptionsFactory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
24.05.20 Rev 26 10.2.7/Dragonflight #frozn45
- made shure that evaluating the "enabled" property always returns a boolean value
- considered empty options for BuildOptionsPage()
24.05.xx Rev 27 10.2.7/Dragonflight #frozn45
- only set config value by TextEdit if text has changed
--]]

-- create new library
local REVISION = 26; -- bump on changes
local REVISION = 27; -- bump on changes
if (type(AzOptionsFactory) == "table") and (AzOptionsFactory.vers >= REVISION) then
return;
end
Expand Down Expand Up @@ -84,7 +86,7 @@ function azof:GetObject(type)
local obj = self.objects[type];
if (not obj) then
local TipTac = _G[PARENT_MOD_NAME];
TipTac:AddMessageToChatFrame(PARENT_MOD_NAME .. ": {error:Invalid factory object type {highlight:[%s]}!}");
TipTac:AddMessageToChatFrame("{caption:" .. PARENT_MOD_NAME .. "}: {error:Invalid factory object type {highlight:[%s]}!}");
return;
end

Expand Down Expand Up @@ -868,7 +870,12 @@ end

-- OnTextChange
local function TextEdit_OnTextChanged(self)
self.factory:SetConfigValue(self.option.var,self:GetText():gsub("||","|"));
local oldText = self.factory:GetConfigValue(self.option.var);
local newText = self:GetText():gsub("||","|");

if (oldText ~= newText) then
self.factory:SetConfigValue(self.option.var,newText);
end
end

-- New TextEdit (dimensions: 301x24, visible dimension: 301x24, visible padding: 0/0/0/0)
Expand Down

0 comments on commit be96cbe

Please sign in to comment.