mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Support a new secret user default JalkutRespectFolderExpansionOnNextUnread, and revise the "next unread" strategy so that whether the search for a next unread wraps around to the top or not is parameterized.
This commit is contained in:
@@ -20,18 +20,21 @@ extension Array where Element == Article {
|
||||
return self[row]
|
||||
}
|
||||
|
||||
func rowOfNextUnreadArticle(_ selectedRow: Int) -> Int? {
|
||||
func orderedRowIndexes(fromIndex startIndex: Int, wrappingToTop wrapping: Bool) -> [Int] {
|
||||
if startIndex >= self.count {
|
||||
// Wrap around to the top if specified
|
||||
return wrapping ? Array<Int>(0..<self.count) : []
|
||||
} else {
|
||||
// Start at the selection and wrap around to the beginning
|
||||
return Array<Int>(startIndex..<self.count) + (wrapping ? Array<Int>(0..<startIndex) : [])
|
||||
}
|
||||
}
|
||||
func rowOfNextUnreadArticle(_ selectedRow: Int, wrappingToTop wrapping: Bool) -> Int? {
|
||||
if isEmpty {
|
||||
return nil
|
||||
}
|
||||
|
||||
var rowIndex = selectedRow
|
||||
while(true) {
|
||||
|
||||
rowIndex = rowIndex + 1
|
||||
if rowIndex >= count {
|
||||
break
|
||||
}
|
||||
for rowIndex in orderedRowIndexes(fromIndex: selectedRow + 1, wrappingToTop: wrapping) {
|
||||
let article = articleAtRow(rowIndex)!
|
||||
if !article.status.read {
|
||||
return rowIndex
|
||||
|
||||
Reference in New Issue
Block a user