@@ -150,8 +150,12 @@ void RefreshTree()
150150 tree . Nodes . Clear ( ) ;
151151 if ( selectedNode == null )
152152 {
153- if ( search . Length == 0 ) FillNodes ( tree . Nodes ) ;
154- else FillNodes ( tree . Nodes , search ) ;
153+ if ( search . Length == 0 ) FillNodes ( tree . Nodes , FilterTypes ( openedTypes . ToList ( ) ) ) ;
154+ else
155+ {
156+ var separator = Settings . EnableItemSpacer ? Settings . ItemSpacer : null ;
157+ FillNodes ( tree . Nodes , search , FilterTypes ( openedTypes . ToList ( ) ) , FilterTypes ( closedTypes . ToList ( ) ) , Settings . MaxItems , separator ) ;
158+ }
155159 tree . SelectedNode = tree . TopNode ;
156160 }
157161 else
@@ -165,17 +169,13 @@ void RefreshTree()
165169 tree . EndUpdate ( ) ;
166170 }
167171
168- void FillNodes ( [ NotNull ] TreeNodeCollection nodes )
172+ static void FillNodes ( [ NotNull ] TreeNodeCollection nodes , [ NotNull ] ICollection < string > types )
169173 {
170- var types = FilterTypes ( openedTypes . ToList ( ) ) ;
171- if ( types . Count > 0 ) nodes . AddRange ( types . Select ( it => ( ClassNode ) NodeFactory . CreateTreeNode ( TypeToClassModel [ it ] ) ) . ToArray ( ) ) ;
174+ if ( types . Count > 0 ) nodes . AddRange ( types . Select ( it => NodeFactory . CreateTreeNode ( TypeToClassModel [ it ] ) ) . ToArray ( ) ) ;
172175 }
173176
174- void FillNodes ( [ NotNull ] TreeNodeCollection nodes , [ NotNull ] string search )
177+ static void FillNodes ( [ NotNull ] TreeNodeCollection nodes , [ NotNull ] string search , [ NotNull ] List < string > openedTypes , [ NotNull ] List < string > closedTypes , int maxItems , string separator )
175178 {
176- var openedTypes = FilterTypes ( this . openedTypes . ToList ( ) ) ;
177- var closedTypes = FilterTypes ( this . closedTypes . ToList ( ) ) ;
178- var maxItems = Settings . MaxItems ;
179179 if ( openedTypes . Count > 0 ) openedTypes = SearchUtil . FindAll ( openedTypes , search ) ;
180180 TreeNode [ ] openedNodes ;
181181 TreeNode [ ] closedNodes ;
@@ -193,42 +193,42 @@ void FillNodes([NotNull] TreeNodeCollection nodes, [NotNull] string search)
193193 var hasOpenedMatches = openedNodes . Length > 0 ;
194194 var hasClosedMatches = closedNodes . Length > 0 ;
195195 if ( hasOpenedMatches ) nodes . AddRange ( openedNodes ) ;
196- if ( Settings . EnableItemSpacer && hasOpenedMatches && hasClosedMatches ) nodes . Add ( Settings . ItemSpacer ) ;
196+ if ( ! string . IsNullOrEmpty ( separator ) && hasOpenedMatches && hasClosedMatches ) nodes . Add ( separator ) ;
197197 if ( hasClosedMatches ) nodes . AddRange ( closedNodes ) ;
198198 }
199199
200+ static void FillNodes ( [ NotNull ] TreeNodeCollection nodes , [ NotNull ] ClassModel inClass , [ NotNull ] string search )
201+ {
202+ var inFile = inClass . InFile ;
203+ var isHaxe = inFile . haXe ;
204+ var items = SearchUtil . FindAll ( inClass . Members . Items , search ) ;
205+ foreach ( var it in items )
206+ {
207+ nodes . Add ( NodeFactory . CreateTreeNode ( inFile , isHaxe , it ) ) ;
208+ }
209+ }
210+
200211 [ NotNull ]
201- static TreeNode [ ] CreateClassNodes ( [ NotNull ] string search , [ NotNull ] IEnumerable < string > sources )
212+ static TreeNode [ ] CreateClassNodes ( [ NotNull ] string search , [ NotNull ] IEnumerable < string > source )
202213 {
203- return sources
214+ return source
204215 . Select ( it => TypeToClassModel [ it ] )
205216 . SortModels ( search )
206217 . Select ( NodeFactory . CreateTreeNode )
207218 . ToArray ( ) ;
208219 }
209220
210221 [ NotNull ]
211- static TreeNode [ ] CreateClassNodes ( [ NotNull ] string search , [ NotNull ] IEnumerable < string > sources , int count )
222+ static TreeNode [ ] CreateClassNodes ( [ NotNull ] string search , [ NotNull ] IEnumerable < string > source , int count )
212223 {
213- return sources
224+ return source
214225 . Select ( it => TypeToClassModel [ it ] )
215226 . SortModels ( search )
216227 . Take ( count )
217228 . Select ( NodeFactory . CreateTreeNode )
218229 . ToArray ( ) ;
219230 }
220231
221- static void FillNodes ( [ NotNull ] TreeNodeCollection nodes , [ NotNull ] ClassModel inClass , [ NotNull ] string search )
222- {
223- var inFile = inClass . InFile ;
224- var isHaxe = inFile . haXe ;
225- var items = SearchUtil . FindAll ( inClass . Members . Items , search ) ;
226- foreach ( var it in items )
227- {
228- nodes . Add ( NodeFactory . CreateTreeNode ( inFile , isHaxe , it ) ) ;
229- }
230- }
231-
232232 [ NotNull ]
233233 List < string > FilterTypes ( [ NotNull ] List < string > list )
234234 {
0 commit comments