mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 08:41:31 +01:00
Begin support for clearing undo commands on sidebar selection change.
This commit is contained in:
parent
f9b3eeb4d7
commit
5f848f568a
@ -16,6 +16,7 @@ import Account
|
||||
class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSource, KeyboardDelegate {
|
||||
|
||||
@IBOutlet var tableView: TimelineTableView!
|
||||
private var undoableCommands = [UndoableCommand]()
|
||||
var didRegisterForNotifications = false
|
||||
var fontSize: FontSize = AppDefaults.shared.timelineFontSize {
|
||||
didSet {
|
||||
@ -126,7 +127,26 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
|
||||
private func pushUndoableCommand(_ undoableCommand: UndoableCommand) {
|
||||
|
||||
undoableCommands += [undoableCommand]
|
||||
}
|
||||
|
||||
private func clearUndoableCommands() {
|
||||
|
||||
// When the timeline is reloaded based on a different sidebar selection,
|
||||
// undoable commands should be dropped — otherwise things like
|
||||
// Redo Mark All as Read are ambiguous. (Do they apply to the previous articles
|
||||
// or to the current articles?)
|
||||
|
||||
guard let undoManager = undoManager else {
|
||||
return
|
||||
}
|
||||
undoableCommands.forEach { undoManager.removeAllActions(withTarget: $0) }
|
||||
undoableCommands = [UndoableCommand]()
|
||||
}
|
||||
|
||||
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
||||
|
||||
if let link = oneSelectedArticle?.preferredLink {
|
||||
|
Loading…
Reference in New Issue
Block a user