Skip to content

Commit

Permalink
[global] Some final fixing and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Mar 12, 2021
1 parent adb8fa9 commit c8cc55e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Common/Controllers/SubProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum SubProcessIOError: Error {
case readFailed, writeFailed
}

protocol SubProcessDelegate: NSObjectProtocol {
protocol SubProcessDelegate: AnyObject {

func subProcessDidConnect()
func subProcess(didReceiveData data: Data)
Expand Down
3 changes: 1 addition & 2 deletions Common/VT100/TerminalInputProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
// Created by Adam Demasi on 20/6/19.
//

public protocol TerminalInputProtocol {
public protocol TerminalInputProtocol: AnyObject {

func receiveKeyboardInput(data: Data)
func openSettings()

var applicationCursor: Bool { get }

Expand Down
2 changes: 1 addition & 1 deletion Mac/UI/Terminal/TerminalTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import AppKit

class TerminalTextView: NSTextView {

var terminalInputDelegate: TerminalInputProtocol?
weak var terminalInputDelegate: TerminalInputProtocol?

override func keyDown(with event: NSEvent) {
super.keyDown(with: event)
Expand Down
2 changes: 1 addition & 1 deletion iOS/UI/Keyboard/TerminalKeyInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

class TerminalKeyInput: TextInputBase {

var terminalInputDelegate: TerminalInputProtocol?
weak var terminalInputDelegate: TerminalInputProtocol?
weak var textView: UITextView! {
didSet {
textView.frame = bounds
Expand Down
9 changes: 0 additions & 9 deletions iOS/UI/Keyboard/TextInputBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@

#import <UIKit/UIKit.h>

#ifndef __IPHONE_11_0
#define UITextSmartQuotesType NSInteger
#define UITextSmartDashesType NSInteger
#define UITextSmartInsertDeleteType NSInteger
#define UITextSmartQuotesTypeNo 1
#define UITextSmartDashesTypeNo 1
#define UITextSmartInsertDeleteTypeNo 1
#endif

@interface TextPosition : UITextPosition

@property (nonatomic, strong) NSNumber *position;
Expand Down
11 changes: 6 additions & 5 deletions iOS/UI/Terminal/TerminalSampleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
@objc(TerminalSampleView)
class TerminalSampleView: UIView {

let textView = TerminalTextView(frame: .zero)
let buffer = VT100()!
let stringSupplier = VT100StringSupplier()
private let textView = TerminalTextView(frame: .zero)
private let buffer = VT100()!
private let stringSupplier = VT100StringSupplier()

override init(frame: CGRect) {
super.init(frame: frame)
Expand All @@ -25,8 +25,9 @@ class TerminalSampleView: UIView {
textView.isSelectable = false
addSubview(textView)

let colorTest = try? Data(contentsOf: Bundle.main.url(forResource: "colortest", withExtension: "txt")!)
buffer.readInputStream(colorTest)
if let colorTest = try? Data(contentsOf: Bundle.main.url(forResource: "colortest", withExtension: "txt")!) {
buffer.readInputStream(colorTest)
}

NotificationCenter.default.addObserver(self, selector: #selector(self.preferencesUpdated), name: Preferences.didChangeNotification, object: nil)
preferencesUpdated()
Expand Down
10 changes: 8 additions & 2 deletions iOS/View Controllers/TerminalSessionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,15 @@ extension TerminalSessionViewController: TerminalControllerDelegate {
// Display the bell HUD, lazily initialising it if it hasn’t been yet
if bellHUDView.superview == nil {
view.addSubview(bellHUDView)
let safeArea: String
if #available(iOS 11, *) {
safeArea = "safe"
} else {
safeArea = "self"
}
view.addCompactConstraints([
"hudView.centerX = self.centerX",
"hudView.centerY = self.centerY / 3"
"hudView.centerX = \(safeArea).centerX",
"hudView.centerY = \(safeArea).centerY / 3"
], metrics: nil, views: [
"self": view!,
"hudView": bellHUDView
Expand Down

0 comments on commit c8cc55e

Please sign in to comment.