When pressing Enter in an empty searchbox, the default value will be re-set. If already set, the contents will be highlighted.
James D. Callahan III [04-19-10 - 09:35]
When pressing Enter in an empty searchbox, the default value will be re-set. If already set, the contents will be highlighted.
diff --git a/Frame.lua b/Frame.lua
index 0c8a4a9..a3dbbf5 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -1633,20 +1633,28 @@ SearchBox:SetScript("OnEnterPressed",
local searchtext = self:GetText()
searchtext = searchtext:trim()
- if searchtext and searchtext ~= _G.SEARCH then
- self.prev_search = searchtext
+ if not searchtext or searchtext == "" then
+ self:SetText(_G.SEARCH)
+ ListFrame:Update(false, false)
+ return
+ end
+ if searchtext == _G.SEARCH then
self:HighlightText()
- self:AddHistoryLine(searchtext)
- SearchRecipes(searchtext)
- ListFrame:Update(false, false)
+ return
+ end
+ self.prev_search = searchtext
- ARL_ExpandButton:SetText(L["EXPANDALL"])
- SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+ self:HighlightText()
+ self:AddHistoryLine(searchtext)
+ SearchRecipes(searchtext)
+ ListFrame:Update(false, false)
- ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
- ARL_SearchButton:Disable()
- end
+ ARL_ExpandButton:SetText(L["EXPANDALL"])
+ SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"])
+
+ ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall")
+ ARL_SearchButton:Disable()
end)
SearchBox:SetScript("OnEditFocusGained",