Skip to content

Commit

Permalink
Merge pull request #336 from iOSappssolutions/main
Browse files Browse the repository at this point in the history
Add small patch to reposition terminal text when navigating to Sessio…
  • Loading branch information
migueldeicaza committed Feb 29, 2024
2 parents ea0f681 + abdabad commit 70659ef
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 70659ef

Please sign in to comment.