Skip to content

Commit

Permalink
Add small patch to reposition terminal text when navigating to Sessio…
Browse files Browse the repository at this point in the history
…n Grid
  • Loading branch information
iOSappssolutions committed Feb 29, 2024
1 parent ea0f681 commit abdabad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/SwiftTerm/iOS/iOSTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,13 @@ open class TerminalView: UIScrollView, UITextInputTraits, UIKeyInput, UIScrollVi
return Int(topVisibleLine)...Int(bottomVisibleLine)
}

public func repositionVisibleFrame () {
let topVisibleLine = contentOffset.y/cellDimension.height
let bottomVisibleLine = (topVisibleLine+frame.height/cellDimension.height)-1
let lines = self.terminal.buffer.lines.count
contentOffset.y = max(0, CGFloat(lines) - bottomVisibleLine) * cellDimension.height
}

@objc func singleTap (_ gestureRecognizer: UITapGestureRecognizer)
{
if isFirstResponder {
Expand Down

0 comments on commit abdabad

Please sign in to comment.