[Request] Limit AutoComplete-Suggestions

Post bugs related to the IDE here
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

[Request] Limit AutoComplete-Suggestions

Post by GPI »

I have a large module SDL (viewtopic.php?f=14&t=76052)

when i write in the IDE the Prefix "SDL::" it adds hundreds of entries in the suggestion-box and the IDE hang a little bit - really annoying.

in autocomplete.pb

Code: Select all

          ; add items and find the closest item to select
          ClearGadgetItems(#GADGET_AutoComplete_List)
          SelectElement(AutoCompleteList(), AutoComplete_Start)
          
          Repeat
            AddGadgetItem(#GADGET_AutoComplete_List, -1, AutoCompleteList())
          Until ListIndex(AutoCompleteList()) = AutoComplete_End Or NextElement(AutoCompleteList()) = 0
          
should be changed to

Code: Select all

         #maxLimitAutoComplete = 50

         ; add items and find the closest item to select
          ClearGadgetItems(#GADGET_AutoComplete_List)
          SelectElement(AutoCompleteList(), AutoComplete_Start)

         If AutoComplete_End - AutoComplete_Start > #maxLimitAutoComplete
           AutoComplete_End = AutoComplete_Start + #maxLimitAutoComplete
         endif
          
          Repeat
            AddGadgetItem(#GADGET_AutoComplete_List, -1, AutoCompleteList())
          Until ListIndex(AutoCompleteList()) >= AutoComplete_End Or NextElement(AutoCompleteList()) = 0 ; i think >= is more "secure" than "="