Skip to content

Commit

Permalink
Selection: do not clamp the row in the function that returns buffer-r…
Browse files Browse the repository at this point in the history
…elative coordinates to screen-relative coordinates
  • Loading branch information
migueldeicaza committed Feb 10, 2023
1 parent 0d2157f commit fe66287
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/SwiftTerm/iOS/iOSTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ open class TerminalView: UIScrollView, UITextInputTraits, UIKeyInput, UIScrollVi
menuController.showMenu(from: self, rect: forRegion)
}

// This is a position relative to the buffer
var lastLongSelect: Position?
var lastLongSelectRegion = CGRect.zero

Expand Down Expand Up @@ -358,7 +359,10 @@ open class TerminalView: UIScrollView, UITextInputTraits, UIKeyInput, UIScrollVi
/// This controls whether the backspace should send ^? or ^H, the default is ^?
public var backspaceSendsControlH: Bool = false

// Returns a buffer-relative position, instead of a screen position.
/// Returns a buffer-relative position, instead of a screen position.
/// - Parameters:
/// - gesture: the location of where the event took place
/// - Returns: both the position where the event took place (either in screen resolution, or buffer relative) and the pixel position to construct the menu location
func calculateTapHit (gesture: UIGestureRecognizer) -> (grid: Position, pixels: Position)
{
func toInt (_ p: CGPoint) -> Position {
Expand All @@ -374,8 +378,7 @@ open class TerminalView: UIScrollView, UITextInputTraits, UIKeyInput, UIScrollVi
if row < 0 {
return (Position(col: 0, row: 0), toInt (point))
}

return (Position(col: min (max (0, col), terminal.cols-1), row: min (row, terminal.rows-1)), toInt (point))
return (Position(col: min (max (0, col), terminal.cols-1), row: row), toInt (point))
}

func encodeFlags (release: Bool) -> Int
Expand Down

0 comments on commit fe66287

Please sign in to comment.