diff --git a/CHANGELOG.md b/CHANGELOG.md index a33e341e1..cfa2b7a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Automatically remove downloads on Suwayomi after reading, configurable via extension settings ([@cpiber](https://github.com/cpiber)) ([#2673](https://github.com/mihonapp/mihon/pull/2673)) - Display author & artist name in MAL search results ([@MajorTanya](https://github.com/MajorTanya)) ([#2833](https://github.com/mihonapp/mihon/pull/2833)) - Add filter options to Updates tab ([@MajorTanya](https://github.com/MajorTanya)) ([#2851](https://github.com/mihonapp/mihon/pull/2851)) +- Add `src:` prefix to search the library by source ID ([@MajorTanya](https://github.com/MajorTanya)) ([#2927](https://github.com/mihonapp/mihon/pull/2927)) ### Improved - Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index 0818bf4a2..d4ee5329a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -23,9 +23,12 @@ data class LibraryItem( * @return true if the manga matches the query, false otherwise. */ fun matches(constraint: String): Boolean { - val sourceName by lazy { sourceManager.getOrStub(libraryManga.manga.source).getNameForMangaInfo() } + val source = sourceManager.getOrStub(libraryManga.manga.source) + val sourceName by lazy { source.getNameForMangaInfo() } if (constraint.startsWith("id:", true)) { return id == constraint.substringAfter("id:").toLongOrNull() + } else if (constraint.startsWith("src:", true)) { + return source.id == constraint.substringAfter("src:").toLongOrNull() } return libraryManga.manga.title.contains(constraint, true) || (libraryManga.manga.author?.contains(constraint, true) ?: false) ||