mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-05 14:27:17 +01:00
Clear undoableCommands when the articles array changes.
This commit is contained in:
parent
5f848f568a
commit
9fbce42959
@ -27,7 +27,10 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
|
||||
private var articles = [Article]() {
|
||||
didSet {
|
||||
tableView.reloadData()
|
||||
if articles != oldValue {
|
||||
clearUndoableCommands()
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,10 +126,16 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
guard let undoManager = undoManager, let markAllReadCommand = MarkAllReadCommand(initialArticles: articles, undoManager: undoManager) else {
|
||||
return
|
||||
}
|
||||
markAllReadCommand.perform()
|
||||
runCommand(markAllReadCommand)
|
||||
}
|
||||
|
||||
// MARK: - Undoable Commands
|
||||
|
||||
private func runCommand(_ undoableCommand: UndoableCommand) {
|
||||
|
||||
pushUndoableCommand(undoableCommand)
|
||||
undoableCommand.perform()
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
private func pushUndoableCommand(_ undoableCommand: UndoableCommand) {
|
||||
|
||||
@ -147,6 +156,8 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
undoableCommands = [UndoableCommand]()
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
||||
|
||||
if let link = oneSelectedArticle?.preferredLink {
|
||||
|
Loading…
Reference in New Issue
Block a user