Skip to content

Commit 7c48793

Browse files
committed
[global] completely useless commit: remove tabs from empty lines
1 parent 124ce22 commit 7c48793

24 files changed

+325
-325
lines changed

NewTerm/Controllers/AppDelegate.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1919
let tintColor = UIColor(red: 76 / 255, green: 161 / 255, blue: 1, alpha: 1)
2020
let backgroundColor = UIColor(white: 26 / 255, alpha: 1)
2121
let lightTintColor = UIColor(white: 60 / 255, alpha: 1)
22-
22+
2323
UINavigationBar.appearance().barStyle = .black
2424
UIToolbar.appearance().barStyle = .black
25-
25+
2626
UITableView.appearance().backgroundColor = backgroundColor
2727
UITableViewCell.appearance().backgroundColor = backgroundColor
2828
// this is deprecated but apple doesn’t exactly provide an easy, supported way to do this
2929
// TODO: ew, swift doesn’t allow setting pre-ios 7 deprecated methods at all
3030
// UITableViewCell.appearance().textColor = textColor
31-
31+
3232
UINavigationBar.appearance().titleTextAttributes = [
3333
.foregroundColor: textColor
3434
]
35-
35+
3636
UITextField.appearance().textColor = textColor
3737
UITextField.appearance().keyboardAppearance = .dark
3838
UITableView.appearance().separatorColor = lightTintColor
39-
39+
4040
UIScrollView.appearance().keyboardDismissMode = .interactive
41-
41+
4242
window = UIWindow(frame: UIScreen.main.bounds)
4343
window!.tintColor = tintColor
4444
window!.rootViewController = UINavigationController(rootViewController: RootViewController())
4545
window!.makeKeyAndVisible()
46-
46+
4747
_ = Preferences.shared
48-
48+
4949
return true
5050
}
5151

NewTerm/Controllers/Preferences.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,67 @@
99
import UIKit
1010

1111
class Preferences {
12-
12+
1313
static let shared = Preferences()
14-
14+
1515
let preferences = UserDefaults.standard
16-
16+
1717
let fontsPlist = NSDictionary(contentsOf: Bundle.main.url(forResource: "Fonts", withExtension: "plist")!)!
1818
let themesPlist = NSDictionary(contentsOf: Bundle.main.url(forResource: "Themes", withExtension: "plist")!)!
19-
19+
2020
var fontMetrics: FontMetrics!
2121
var colorMap: VT100ColorMap!
22-
22+
2323
init() {
2424
preferences.register(defaults: [
2525
"fontName": "Fira Code",
2626
"fontSize": 12,
2727
"theme": "kirb"
2828
])
29-
29+
3030
NotificationCenter.default.addObserver(self, selector: #selector(self.preferencesUpdated), name: UserDefaults.didChangeNotification, object: preferences)
3131
preferencesUpdated()
3232
}
33-
33+
3434
var fontName: String {
3535
get { return preferences.object(forKey: "fontName") as! String }
3636
}
37-
37+
3838
var fontSize: CGFloat {
3939
get { return preferences.object(forKey: "fontSize") as! CGFloat }
4040
}
41-
41+
4242
var themeName: String {
4343
get { return preferences.object(forKey: "theme") as! String }
4444
}
45-
45+
4646
// MARK: - Callbacks
47-
47+
4848
@objc private func preferencesUpdated() {
4949
fontMetricsChanged()
5050
colorMapChanged()
5151
}
52-
52+
5353
private func fontMetricsChanged() {
5454
var regularFont: UIFont?
5555
var boldFont: UIFont?
56-
56+
5757
if let family = fontsPlist[fontName] as? [String: String] {
5858
if family["Regular"] != nil && family["Bold"] != nil {
5959
regularFont = UIFont(name: family["Regular"]!, size: fontSize)
6060
boldFont = UIFont(name: family["Bold"]!, size: fontSize)
6161
}
6262
}
63-
63+
6464
if regularFont == nil || boldFont == nil {
6565
NSLog("font %@ size %f could not be initialised", fontName, fontSize)
6666
preferences.set("Courier", forKey: "fontName")
6767
return
6868
}
69-
69+
7070
fontMetrics = FontMetrics(font: regularFont, boldFont: boldFont)
7171
}
72-
72+
7373
func colorMapChanged() {
7474
// if the theme doesn’t exist… how did we get here? force it to the default, which will call
7575
// this method again
@@ -78,9 +78,9 @@ class Preferences {
7878
preferences.set("kirb", forKey: "theme")
7979
return
8080
}
81-
81+
8282
colorMap = VT100ColorMap(dictionary: theme)
8383
}
84-
84+
8585
}
8686

NewTerm/Controllers/SubProcess.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ protocol SubProcessDelegate: NSObjectProtocol {
2424
func subProcess(didReceiveData data: Data)
2525
func subProcess(didDisconnectWithError error: Error?)
2626
func subProcess(didReceiveError error: Error)
27-
27+
2828
}
2929

3030
class SubProcess: NSObject {
3131

3232
private static let newlineData = Data(bytes: "\r\n", count: 2)
33-
33+
3434
// Simply used to initialize the terminal and thrown away after startup.
3535
private static let defaultWidth: UInt16 = 80
3636
private static let defaultHeight: UInt16 = 25
@@ -40,7 +40,7 @@ class SubProcess: NSObject {
4040
private var childPID: pid_t?
4141
private var fileDescriptor: Int32?
4242
public var fileHandle: FileHandle?
43-
43+
4444
var screenSize: ScreenSize = ScreenSize() {
4545
didSet {
4646
if fileDescriptor == nil {
@@ -80,7 +80,7 @@ class SubProcess: NSObject {
8080
NSLog("fork failed: %d: %s", errno, strerror(errno))
8181
throw SubProcessIllegalStateError.forkFailed
8282
}
83-
83+
8484
case 0:
8585
// Handle the child subprocess. First try to use /bin/login since it’s a little nicer. Fall
8686
// back to /bin/bash if that is available.
@@ -97,7 +97,7 @@ class SubProcess: NSObject {
9797
_ = attemptStartProcess(path: "/bin/sh", arguments: shArgs, environment: env)
9898
_ = attemptStartProcess(path: "/bootstrap/bin/bash", arguments: shArgs, environment: env)
9999
break
100-
100+
101101
default:
102102
NSLog("process forked: %d", pid)
103103
childPID = pid
@@ -154,7 +154,7 @@ class SubProcess: NSObject {
154154
if !fileManager.fileExists(atPath: path) {
155155
return -1
156156
}
157-
157+
158158
// Notably, we don't test group or other bits so this still might not always
159159
// notice if the binary is not executable by us.
160160
if !fileManager.isExecutableFile(atPath: path) {

NewTerm/Controllers/TerminalController.swift

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@
99
import UIKit
1010

1111
protocol TerminalControllerDelegate {
12-
12+
1313
func refresh(attributedString: NSAttributedString, backgroundColor: UIColor)
1414
func activateBell()
1515
func close()
1616
func didReceiveError(error: Error)
17-
17+
1818
func openSettings()
19-
19+
2020
}
2121

2222
class TerminalController: VT100 {
23-
23+
2424
var delegate: TerminalControllerDelegate?
25-
25+
2626
private var updateQueue: DispatchQueue!
27-
27+
2828
private var stringSupplier = VT100StringSupplier()
29-
29+
3030
var colorMap: VT100ColorMap {
3131
get { return stringSupplier.colorMap! }
3232
set { stringSupplier.colorMap = newValue }
3333
}
34-
34+
3535
var fontMetrics: FontMetrics {
3636
get { return stringSupplier.fontMetrics! }
3737
set { stringSupplier.fontMetrics = newValue }
3838
}
39-
39+
4040
private var subProcess: SubProcess?
4141
private var processEnded: Bool = false
42-
42+
4343
override var screenSize: ScreenSize {
4444
get { return super.screenSize }
4545

@@ -52,45 +52,45 @@ class TerminalController: VT100 {
5252
subProcess?.screenSize = screenSize
5353
}
5454
}
55-
55+
5656
override init() {
5757
super.init()
58-
58+
5959
updateQueue = DispatchQueue(label: String(format: "au.com.hbang.NewTerm.update-queue-%p", self))
60-
60+
6161
stringSupplier.screenBuffer = self
62-
62+
6363
NotificationCenter.default.addObserver(self, selector: #selector(self.preferencesUpdated), name: UserDefaults.didChangeNotification, object: nil)
6464
preferencesUpdated()
6565
}
66-
66+
6767
@objc func preferencesUpdated() {
6868
let preferences = Preferences.shared
6969
stringSupplier.colorMap = preferences.colorMap
7070
stringSupplier.fontMetrics = preferences.fontMetrics
71-
71+
7272
refresh()
7373
}
74-
74+
7575
// MARK: - Sub Process
76-
76+
7777
func startSubProcess() throws {
7878
processEnded = false
79-
79+
8080
subProcess = SubProcess()
8181
subProcess!.delegate = self
8282
try subProcess!.start()
8383
}
84-
84+
8585
func stopSubProcess() throws {
8686
processEnded = true
8787
try subProcess!.stop()
8888
}
89-
89+
9090
}
9191

9292
extension TerminalController: TerminalInputProtocol {
93-
93+
9494
func receiveKeyboardInput(data: Data) {
9595
if processEnded {
9696
// we’ve told the user that pressing a key will close the tab, so close the tab
@@ -104,68 +104,68 @@ extension TerminalController: TerminalInputProtocol {
104104
func openSettings() {
105105
delegate!.openSettings()
106106
}
107-
107+
108108
}
109109

110110
// ScreenBufferRefreshDelegate
111111
extension TerminalController {
112-
112+
113113
override func refresh() {
114114
super.refresh()
115-
115+
116116
// TODO: this is called due to -[VT100 init], and we aren’t ready yet… we’ll be called when we
117117
// are anyway, so don’t worry about it
118118
if updateQueue == nil {
119119
return
120120
}
121-
121+
122122
// TODO: we should handle the scrollback separately so it only appears if the user scrolls
123123
updateQueue.async {
124124
let attributedString = self.stringSupplier.attributedString()!
125125
let backgroundColor = self.stringSupplier.colorMap!.background!
126-
126+
127127
DispatchQueue.main.async {
128128
self.delegate?.refresh(attributedString: attributedString, backgroundColor: backgroundColor)
129129
}
130130
}
131131
}
132-
132+
133133
override func activateBell() {
134134
super.activateBell()
135135
delegate?.activateBell()
136136
}
137-
137+
138138
}
139139

140140
extension TerminalController: SubProcessDelegate {
141-
141+
142142
func subProcessDidConnect() {
143143
// yay
144144
}
145-
145+
146146
func subProcess(didReceiveData data: Data) {
147147
// Simply forward the input stream down the VT100 processor. When it notices changes to the
148148
// screen, it should invoke our refresh delegate below.
149149
readInputStream(data)
150150
}
151-
151+
152152
func subProcess(didDisconnectWithError error: Error?) {
153153
// we have nothing useful to do if the process has already ended
154154
if processEnded {
155155
return
156156
}
157-
157+
158158
processEnded = true
159159

160160
// show a message inside the terminal indicating that the session has ended, and that the user
161161
// can press any key to close the tab
162162
let message = "[\(NSLocalizedString("PROCESS_COMPLETED_TITLE", comment: ""))]\r\n\(NSLocalizedString("PROCESS_COMPLETED_MESSAGE", comment: ""))"
163163
readInputStream(message.data(using: .utf8))
164164
}
165-
165+
166166
func subProcess(didReceiveError error: Error) {
167167
NSLog("subprocess received error… %@", error as NSError)
168168
delegate?.didReceiveError(error: error)
169169
}
170-
170+
171171
}

NewTerm/Global.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let isBigDevice: Bool = {
1212
switch UIDevice.current.userInterfaceIdiom {
1313
case .phone, .carPlay, .unspecified:
1414
return false
15-
15+
1616
case .pad, .tv:
1717
return true
1818
}

0 commit comments

Comments
 (0)