Made sure an item in the timeline is selected when getting focus - Issue #558
This commit is contained in:
parent
08110044ea
commit
6fa019702d
@ -20,6 +20,16 @@ class TimelineTableView: NSTableView {
|
|||||||
}
|
}
|
||||||
super.keyDown(with: event)
|
super.keyDown(with: event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func becomeFirstResponder() -> Bool {
|
||||||
|
if super.becomeFirstResponder() {
|
||||||
|
if selectedRow == -1 && numberOfRows > 0 {
|
||||||
|
rs_selectRowAndScrollToVisible(0)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - NSView
|
// MARK: - NSView
|
||||||
|
|
||||||
|
@ -369,15 +369,12 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func focus() {
|
func focus() {
|
||||||
|
|
||||||
guard let window = tableView.window else {
|
guard let window = tableView.window else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
window.makeFirstResponderUnlessDescendantIsFirstResponder(tableView)
|
window.makeFirstResponderUnlessDescendantIsFirstResponder(tableView)
|
||||||
if !hasAtLeastOneSelectedArticle && articles.count > 0 {
|
|
||||||
tableView.rs_selectRowAndScrollToVisible(0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Notifications
|
// MARK: - Notifications
|
||||||
|
Loading…
x
Reference in New Issue
Block a user