mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Pick up some previous articles in case we were scrolling fast
This commit is contained in:
@@ -342,11 +342,16 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
let firstVisibleRowIndex = tableView.rows(in: tableView.visibleRect).location
|
||||
|
||||
guard let article = articles.articleAtRow(firstVisibleRowIndex - 1),
|
||||
article.status.read == false,
|
||||
!directlyMarkedAsUnreadArticles.contains(article),
|
||||
let undoManager = undoManager,
|
||||
let markReadCommand = MarkStatusCommand(initialArticles: [article], markingRead: true, directlyMarked: false, undoManager: undoManager) else {
|
||||
// We go back 5 extras incase we didn't get a notification during a fast scroll
|
||||
let indexSet = IndexSet(integersIn: max(firstVisibleRowIndex - 6, 0)...max(firstVisibleRowIndex - 1, 0))
|
||||
guard let articles = articles.articlesForIndexes(indexSet).unreadArticles() else {
|
||||
return
|
||||
}
|
||||
|
||||
let markArticles = articles.filter { !directlyMarkedAsUnreadArticles.contains($0) }
|
||||
guard !markArticles.isEmpty,
|
||||
let undoManager = undoManager,
|
||||
let markReadCommand = MarkStatusCommand(initialArticles: markArticles, markingRead: true, directlyMarked: false, undoManager: undoManager) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user