View Feature Request
Limit number of non-locked search tabs
Feature #: 1765
File: AwesomeGuildStore
Date: 04/11/20 04:38 AM
By: thifi
Status: Wont add Feature
It would be awesome if AGS wouldn't just grow the number of tabs indefinitely, but users would be able to put a cap on it. I've implemented what would make sense for me:

SearchManager.lua:

Lua Code:
  1. function SearchManager:AddSearch(saveData)
  2.     local search = SearchState:New(self, saveData)
  3.    
  4.     local enabledSearches = {}
  5.     for i = 1, #self.searches do
  6.         if (self.searches[i]:GetSaveData().enabled) then
  7.             table.insert(enabledSearches, self.searches[i])
  8.         end
  9.     end
  10.    
  11.     while (#enabledSearches >= 10) do
  12.         self:RemoveSearch(table.remove(enabledSearches, 1))
  13.     end
  14.    
  15.     local newIndex = #self.searches + 1
  16.     search.sortIndex = newIndex -- this is so we do not have to refresh the list twice
  17.     self.searches[newIndex] = search
  18.     self.saveData.searches[newIndex] = search:GetSaveData()
  19.  
  20.     AGS.internal:FireCallbacks(AGS.callback.SEARCH_LIST_CHANGED, REQUIRES_FULL_UPDATE)
  21.     return search
  22. end

Of course it would make sense to expose this value on the config UI but I didn't bother with it. Hardwiring it to 10 works perfectly for me.

RSS 2.0 Feed for Favorite CommentsNotes Sort Options
By: sirinsidiator - 04/11/20 07:08 AM
I do realize that tab management seems to pose a problem for a considerable part of users, but I am not sure if limiting them in this way is the solution. I never intended tabs to be created in such quantity that requires to clean them up automatically. So for me the question is, why are there so many tabs?
Someone else recently mentioned that a lot of them come from the "Search for item" feature, which is something I plan to look into. Is this also the case for you, or is there a different reason why you need to cap them?
By: thifi - 04/11/20 12:16 PM
Yes, exactly. When I go through my inventory to sell items, I search for every item to make sure I choose the right price. Therefore at the end of a lengthy seller session I end up with ~70 tabs. The patch above solves the problem perfectly for me. I don't think it is needed by everyone, that's why i suggested to make it configurable.