@@ -143,6 +143,10 @@ wchar_t *getTextboxString(state_t *state)
143
143
144
144
void filterReduceByStr (state_t * state , const wchar_t * str )
145
145
{
146
+ if (wcslen (str ) == 0 ) {
147
+ return ;
148
+ }
149
+
146
150
const size_t c = state -> searchResultCount ;
147
151
state -> searchResultCount = 0 ;
148
152
if (state -> settings .caseSensitiveSearch ) {
@@ -166,14 +170,10 @@ void filterReduceByKeywords(state_t *state, wchar_t *str)
166
170
wchar_t * space ;
167
171
while ((space = StrStrW (str , L" " ))) {
168
172
space [0 ] = 0 ;
169
- if (wcslen (str ) > 0 ) {
170
- filterReduceByStr (state , str );
171
- }
172
- str = space + 1 ;
173
- }
174
- if (wcslen (str ) > 0 ) {
175
173
filterReduceByStr (state , str );
174
+ str = space + 1 ;
176
175
}
176
+ filterReduceByStr (state , str );
177
177
}
178
178
179
179
void updateSearchResults (state_t * state )
@@ -186,15 +186,13 @@ void updateSearchResults(state_t *state)
186
186
187
187
// Filter by chosen method
188
188
wchar_t * str = getTextboxString (state );
189
- if (wcslen (str ) > 0 ) {
190
- switch (state -> settings .filterMode ) {
191
- case FM_COMPLETE :
192
- filterReduceByStr (state , str );
193
- break ;
194
- case FM_KEYWORDS :
195
- filterReduceByKeywords (state , str );
196
- break ;
197
- }
189
+ switch (state -> settings .filterMode ) {
190
+ case FM_COMPLETE :
191
+ filterReduceByStr (state , str );
192
+ break ;
193
+ case FM_KEYWORDS :
194
+ filterReduceByKeywords (state , str );
195
+ break ;
198
196
}
199
197
200
198
state -> selectedResultIndex = state -> searchResultCount > 0 ? 0 : SELECTED_INDEX_NO_RESULT ;
0 commit comments