Fix: FindItems returned wrong indices if mustContainBoth is false

This commit is contained in:
Egor 2024-04-21 18:03:25 +03:00 committed by GitHub
parent e119d15762
commit b1d6673c9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -447,7 +447,7 @@ func (l *List) FindItems(mainSearch, secondarySearch string, mustContainBoth, ig
mainContained := strings.Contains(mainText, mainSearch) mainContained := strings.Contains(mainText, mainSearch)
secondaryContained := strings.Contains(secondaryText, secondarySearch) secondaryContained := strings.Contains(secondaryText, secondarySearch)
if mustContainBoth && mainContained && secondaryContained || if mustContainBoth && mainContained && secondaryContained ||
!mustContainBoth && (mainText != "" && mainContained || secondaryText != "" && secondaryContained) { !mustContainBoth && (mainSearch != "" && mainContained || secondarySearch != "" && secondaryContained) {
indices = append(indices, index) indices = append(indices, index)
} }
} }