mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 08:09:41 +01:00
Changed timeline behavior to scroll selected entry to middle when next selected entry isn't visible. Issue #604
This commit is contained in:
parent
9d4f00f3d7
commit
d2fe0bd4d4
@ -2,6 +2,18 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>key</key>
|
||||
<string>[uparrow]</string>
|
||||
<key>action</key>
|
||||
<string>selectNextUp:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>key</key>
|
||||
<string>[downarrow]</string>
|
||||
<key>action</key>
|
||||
<string>selectNextDown:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>key</key>
|
||||
<string>[leftarrow]</string>
|
||||
|
@ -253,6 +253,51 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
NSPasteboard.general.copyObjects(selectedArticles)
|
||||
}
|
||||
|
||||
@IBAction func selectNextUp(_ sender: Any?) {
|
||||
|
||||
guard let lastSelectedRow = tableView.selectedRowIndexes.last else {
|
||||
return
|
||||
}
|
||||
|
||||
let nextRowIndex = lastSelectedRow - 1
|
||||
if nextRowIndex <= 0 {
|
||||
tableView.scrollTo(row: 0, extraHeight: 0)
|
||||
}
|
||||
|
||||
tableView.rs_selectRow(nextRowIndex)
|
||||
|
||||
let followingRowIndex = nextRowIndex - 1
|
||||
if followingRowIndex < 0 {
|
||||
return
|
||||
}
|
||||
|
||||
tableView.scrollToIfNotVisable(index: followingRowIndex)
|
||||
|
||||
}
|
||||
|
||||
@IBAction func selectNextDown(_ sender: Any?) {
|
||||
|
||||
guard let firstSelectedRow = tableView.selectedRowIndexes.first else {
|
||||
return
|
||||
}
|
||||
|
||||
let tableMaxIndex = tableView.numberOfRows - 1
|
||||
let nextRowIndex = firstSelectedRow + 1
|
||||
if nextRowIndex >= tableMaxIndex {
|
||||
tableView.scrollTo(row: tableMaxIndex, extraHeight: 0)
|
||||
}
|
||||
|
||||
tableView.rs_selectRow(nextRowIndex)
|
||||
|
||||
let followingRowIndex = nextRowIndex + 1
|
||||
if followingRowIndex > tableMaxIndex {
|
||||
return
|
||||
}
|
||||
|
||||
tableView.scrollToIfNotVisable(index: followingRowIndex)
|
||||
|
||||
}
|
||||
|
||||
func toggleReadStatusForSelectedArticles() {
|
||||
|
||||
// If any one of the selected articles is unread, then mark them as read.
|
||||
|
Loading…
Reference in New Issue
Block a user