Ensure prev/next row lies beyond visible

This commit is contained in:
Davide De Rosa 2021-04-14 16:11:10 +02:00
parent 74d5b6bb8f
commit fe084bf42e
1 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,9 @@ class DebugLogViewController: NSViewController {
let visibleRow = firstVisibleRow()
let viewport = logLines[0..<visibleRow]
let row = viewport.lastIndex(of: Substring(GroupConstants.VPN.sessionMarker)) ?? 0
guard row < visibleRow else {
return
}
tableTextLog.scrollRowToVisible(row)
}
@ -158,6 +161,9 @@ class DebugLogViewController: NSViewController {
}
let viewport = logLines[(visibleRow + 1)..<logLines.count]
let row = viewport.firstIndex(of: Substring(GroupConstants.VPN.sessionMarker)) ?? (logLines.count - 1)
guard row > visibleRow else {
return
}
tableTextLog.scrollRowToVisible(row)
}