Merge pull request #974 from Egor3f/patch-1

Fix: FindItems returned wrong indices if mustContainBoth is false
This commit is contained in:
rivo 2024-04-26 19:34:58 +02:00 committed by GitHub
commit c766eefb38
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)
secondaryContained := strings.Contains(secondaryText, secondarySearch)
if mustContainBoth && mainContained && secondaryContained ||
!mustContainBoth && (mainText != "" && mainContained || secondaryText != "" && secondaryContained) {
!mustContainBoth && (mainSearch != "" && mainContained || secondarySearch != "" && secondaryContained) {
indices = append(indices, index)
}
}