Use smart case for filters

This commit is contained in:
miruka 2019-08-19 18:25:00 -04:00
parent aba01d54e8
commit de4d984ded
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,5 @@
- Refactoring
- Don't show the highlight rectangle sliding when clicking room
- Make room loading faster
- Filter smart case
- Make all icon SVG files white/black, since we can now use ColorOverlay
- Make the icon blue in EditAccount when hovering and no avatar set

View File

@ -74,12 +74,15 @@ function processedEventText(ev) {
function filterMatches(filter, text) {
filter = filter.toLowerCase()
let filter_lower = filter.toLowerCase()
if (filter_lower == filter) {
// Consider case only if filter isn't all lowercase (smart case)
filter = filter_lower
text = text.toLowerCase()
}
let words = filter.split(" ")
for (let word of words) {
for (let word of filter.split(" ")) {
if (word && ! text.includes(word)) {
return false
}