Skip to content

Commit

Permalink
Auto-eval if enter pressed at end of text entry (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes authored May 16, 2019
1 parent 88a765c commit b7a5141
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Replete/ReplViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ class ReplViewController: UIViewController, UITableViewDataSource, UITableViewDe
if (text == "\n") {
enterPressed = true;
}

if (enterPressed && range.location == currentText!.count) {
enterPressed = false
sendAction()
return false;
}

if (textView.intrinsicContentSize.width >= textView.frame.width - evalButton.frame.width - 12){ // the magic number is inset widths summed
textView.isScrollEnabled = true
}
Expand Down

0 comments on commit b7a5141

Please sign in to comment.