Set COLUMNS and ROWS environment variables
@@ -394,8 +394,10 @@ import UIKit
return Int((viewHeight / charHeight).rounded(.down))
}
- putenv("COLUMNS=\(columns)".cValue)
- putenv("ROWS=\(rows)".cValue)
+ print(columns)
+ print(rows)
+ setenv("COLUMNS", "\(columns)", 1)
+ setenv("ROWS", "\(rows)", 1)
}
// MARK: - View controller
@@ -421,10 +423,8 @@ import UIKit
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name:UIResponder.keyboardWillHideNotification, object: nil)
- if navigationController?.modalPresentationStyle != .formSheet {
movableTextField = MovableTextField(console: self)
}
- }
override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
@@ -437,12 +437,13 @@ import UIKit
textView.frame = view.safeAreaLayoutGuide.layoutFrame
textView.frame.size.height -= 44
textView.frame.origin.y = view.safeAreaLayoutGuide.layoutFrame.origin.y
+
+ updateSize()
}
override open func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
- if navigationController?.modalPresentationStyle != .formSheet {
if movableTextField == nil {
movableTextField = MovableTextField(console: self)
movableTextField?.placeholder = prompt ?? ""
@@ -473,7 +474,6 @@ import UIKit
}
self.textView.scrollToBottom()
}
- }
var items = [UIBarButtonItem]()
func appendStop() {
@@ -540,9 +540,12 @@ import UIKit
}
guard view.frame.height != size.height else {
- textView.frame.size.width = view.safeAreaLayoutGuide.layoutFrame.width
- textView.frame.size.height = view.safeAreaLayoutGuide.layoutFrame.height-44
- textView.frame.origin.y = view.safeAreaLayoutGuide.layoutFrame.origin.y
+ _ = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false, block: { (_) in
+ self.textView.frame.size.width = self.view.safeAreaLayoutGuide.layoutFrame.width
+ self.textView.frame.size.height = self.view.safeAreaLayoutGuide.layoutFrame.height-44
+ self.textView.frame.origin.y = self.view.safeAreaLayoutGuide.layoutFrame.origin.y
+ self.updateSize()
+ })
return
}
@@ -558,6 +561,7 @@ import UIKit
self.movableTextField?.textField.becomeFirstResponder()
}
self.movableTextField?.applyTheme()
+ self.updateSize()
}) // TODO: Anyway to to it without a timer?
}
