Miguel de Icaza 5 жил өмнө
parent
commit
a6234c3fea

+ 0 - 110
SwiftTerm.xcodeproj/project.pbxproj

@@ -7,7 +7,6 @@
 	objects = {
 	objects = {
 
 
 /* Begin PBXBuildFile section */
 /* Begin PBXBuildFile section */
-		49AE01A12410AB0A0051E902 /* SwiftTerm in Frameworks */ = {isa = PBXBuildFile; productRef = 49AE01A02410AB0A0051E902 /* SwiftTerm */; };
 		49BD1A5E224207B5005A2252 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49BD1A5D224207B5005A2252 /* AppDelegate.swift */; };
 		49BD1A5E224207B5005A2252 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49BD1A5D224207B5005A2252 /* AppDelegate.swift */; };
 		49BD1A60224207B5005A2252 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49BD1A5F224207B5005A2252 /* ViewController.swift */; };
 		49BD1A60224207B5005A2252 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49BD1A5F224207B5005A2252 /* ViewController.swift */; };
 		49BD1A63224207B5005A2252 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 49BD1A61224207B5005A2252 /* Main.storyboard */; };
 		49BD1A63224207B5005A2252 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 49BD1A61224207B5005A2252 /* Main.storyboard */; };
@@ -34,7 +33,6 @@
 
 
 /* Begin PBXFileReference section */
 /* Begin PBXFileReference section */
 		49AE01872410AA650051E902 /* SwiftTerm */ = {isa = PBXFileReference; lastKnownFileType = folder; path = SwiftTerm; sourceTree = "<group>"; };
 		49AE01872410AA650051E902 /* SwiftTerm */ = {isa = PBXFileReference; lastKnownFileType = folder; path = SwiftTerm; sourceTree = "<group>"; };
-		49AE018C2410AAFE0051E902 /* OldMacTerminal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OldMacTerminal.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		49BD1A5A224207B5005A2252 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		49BD1A5A224207B5005A2252 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		49BD1A5D224207B5005A2252 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		49BD1A5D224207B5005A2252 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		49BD1A5F224207B5005A2252 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
 		49BD1A5F224207B5005A2252 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -56,14 +54,6 @@
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
-		49AE01892410AAFE0051E902 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				49AE01A12410AB0A0051E902 /* SwiftTerm in Frameworks */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
 		49BD1A57224207B5005A2252 /* Frameworks */ = {
 		49BD1A57224207B5005A2252 /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
@@ -113,7 +103,6 @@
 			children = (
 			children = (
 				49BD1A5A224207B5005A2252 /* iOS.app */,
 				49BD1A5A224207B5005A2252 /* iOS.app */,
 				49BD1A6E224207B7005A2252 /* iOSTests.xctest */,
 				49BD1A6E224207B7005A2252 /* iOSTests.xctest */,
-				49AE018C2410AAFE0051E902 /* OldMacTerminal.app */,
 				49C75E3F2419C7E9008977FE /* MacTerminal.app */,
 				49C75E3F2419C7E9008977FE /* MacTerminal.app */,
 			);
 			);
 			name = Products;
 			name = Products;
@@ -166,26 +155,6 @@
 /* End PBXGroup section */
 /* End PBXGroup section */
 
 
 /* Begin PBXNativeTarget section */
 /* Begin PBXNativeTarget section */
-		49AE018B2410AAFE0051E902 /* OldMacTerminal */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 49AE019C2410AAFF0051E902 /* Build configuration list for PBXNativeTarget "OldMacTerminal" */;
-			buildPhases = (
-				49AE01882410AAFE0051E902 /* Sources */,
-				49AE01892410AAFE0051E902 /* Frameworks */,
-				49AE018A2410AAFE0051E902 /* Resources */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = OldMacTerminal;
-			packageProductDependencies = (
-				49AE01A02410AB0A0051E902 /* SwiftTerm */,
-			);
-			productName = MacTerminal;
-			productReference = 49AE018C2410AAFE0051E902 /* OldMacTerminal.app */;
-			productType = "com.apple.product-type.application";
-		};
 		49BD1A59224207B5005A2252 /* iOS */ = {
 		49BD1A59224207B5005A2252 /* iOS */ = {
 			isa = PBXNativeTarget;
 			isa = PBXNativeTarget;
 			buildConfigurationList = 49BD1A77224207B7005A2252 /* Build configuration list for PBXNativeTarget "iOS" */;
 			buildConfigurationList = 49BD1A77224207B7005A2252 /* Build configuration list for PBXNativeTarget "iOS" */;
@@ -251,9 +220,6 @@
 				LastUpgradeCheck = 1010;
 				LastUpgradeCheck = 1010;
 				ORGANIZATIONNAME = "Miguel de Icaza";
 				ORGANIZATIONNAME = "Miguel de Icaza";
 				TargetAttributes = {
 				TargetAttributes = {
-					49AE018B2410AAFE0051E902 = {
-						CreatedOnToolsVersion = 11.3.1;
-					};
 					49BD1A59224207B5005A2252 = {
 					49BD1A59224207B5005A2252 = {
 						CreatedOnToolsVersion = 10.1;
 						CreatedOnToolsVersion = 10.1;
 						LastSwiftMigration = 1130;
 						LastSwiftMigration = 1130;
@@ -283,20 +249,12 @@
 			targets = (
 			targets = (
 				49BD1A59224207B5005A2252 /* iOS */,
 				49BD1A59224207B5005A2252 /* iOS */,
 				49BD1A6D224207B7005A2252 /* iOSTests */,
 				49BD1A6D224207B7005A2252 /* iOSTests */,
-				49AE018B2410AAFE0051E902 /* OldMacTerminal */,
 				49C75E3E2419C7E9008977FE /* MacTerminal */,
 				49C75E3E2419C7E9008977FE /* MacTerminal */,
 			);
 			);
 		};
 		};
 /* End PBXProject section */
 /* End PBXProject section */
 
 
 /* Begin PBXResourcesBuildPhase section */
 /* Begin PBXResourcesBuildPhase section */
-		49AE018A2410AAFE0051E902 /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
 		49BD1A58224207B5005A2252 /* Resources */ = {
 		49BD1A58224207B5005A2252 /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
@@ -326,13 +284,6 @@
 /* End PBXResourcesBuildPhase section */
 /* End PBXResourcesBuildPhase section */
 
 
 /* Begin PBXSourcesBuildPhase section */
 /* Begin PBXSourcesBuildPhase section */
-		49AE01882410AAFE0051E902 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
 		49BD1A56224207B5005A2252 /* Sources */ = {
 		49BD1A56224207B5005A2252 /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
@@ -398,54 +349,6 @@
 /* End PBXVariantGroup section */
 /* End PBXVariantGroup section */
 
 
 /* Begin XCBuildConfiguration section */
 /* Begin XCBuildConfiguration section */
-		49AE019D2410AAFF0051E902 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CODE_SIGN_ENTITLEMENTS = MacTerminal/MacTerminal.entitlements;
-				CODE_SIGN_STYLE = Automatic;
-				COMBINE_HIDPI_IMAGES = YES;
-				DEVELOPMENT_ASSET_PATHS = "\"MacTerminal/Preview Content\"";
-				DEVELOPMENT_TEAM = PJQC57N853;
-				ENABLE_HARDENED_RUNTIME = YES;
-				ENABLE_PREVIEWS = YES;
-				INFOPLIST_FILE = MacTerminal/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = (
-					"$(inherited)",
-					"@executable_path/../Frameworks",
-				);
-				MACOSX_DEPLOYMENT_TARGET = 10.15;
-				PRODUCT_BUNDLE_IDENTIFIER = org.tirania.MacTerminal;
-				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx;
-				SWIFT_VERSION = 5.0;
-			};
-			name = Debug;
-		};
-		49AE019E2410AAFF0051E902 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CODE_SIGN_ENTITLEMENTS = MacTerminal/MacTerminal.entitlements;
-				CODE_SIGN_STYLE = Automatic;
-				COMBINE_HIDPI_IMAGES = YES;
-				DEVELOPMENT_ASSET_PATHS = "\"MacTerminal/Preview Content\"";
-				DEVELOPMENT_TEAM = PJQC57N853;
-				ENABLE_HARDENED_RUNTIME = YES;
-				ENABLE_PREVIEWS = YES;
-				INFOPLIST_FILE = MacTerminal/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = (
-					"$(inherited)",
-					"@executable_path/../Frameworks",
-				);
-				MACOSX_DEPLOYMENT_TARGET = 10.15;
-				PRODUCT_BUNDLE_IDENTIFIER = org.tirania.MacTerminal;
-				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx;
-				SWIFT_VERSION = 5.0;
-			};
-			name = Release;
-		};
 		49BD1A75224207B7005A2252 /* Debug */ = {
 		49BD1A75224207B7005A2252 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
@@ -683,15 +586,6 @@
 /* End XCBuildConfiguration section */
 /* End XCBuildConfiguration section */
 
 
 /* Begin XCConfigurationList section */
 /* Begin XCConfigurationList section */
-		49AE019C2410AAFF0051E902 /* Build configuration list for PBXNativeTarget "OldMacTerminal" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				49AE019D2410AAFF0051E902 /* Debug */,
-				49AE019E2410AAFF0051E902 /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
 		49BD1A55224207B4005A2252 /* Build configuration list for PBXProject "SwiftTerm" */ = {
 		49BD1A55224207B4005A2252 /* Build configuration list for PBXProject "SwiftTerm" */ = {
 			isa = XCConfigurationList;
 			isa = XCConfigurationList;
 			buildConfigurations = (
 			buildConfigurations = (
@@ -731,10 +625,6 @@
 /* End XCConfigurationList section */
 /* End XCConfigurationList section */
 
 
 /* Begin XCSwiftPackageProductDependency section */
 /* Begin XCSwiftPackageProductDependency section */
-		49AE01A02410AB0A0051E902 /* SwiftTerm */ = {
-			isa = XCSwiftPackageProductDependency;
-			productName = SwiftTerm;
-		};
 		49C75E512419C917008977FE /* SwiftTerm */ = {
 		49C75E512419C917008977FE /* SwiftTerm */ = {
 			isa = XCSwiftPackageProductDependency;
 			isa = XCSwiftPackageProductDependency;
 			productName = SwiftTerm;
 			productName = SwiftTerm;

+ 2 - 2
SwiftTerm.xcodeproj/xcuserdata/miguel.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -17,7 +17,7 @@
 		<key>OldMacTerminal.xcscheme_^#shared#^_</key>
 		<key>OldMacTerminal.xcscheme_^#shared#^_</key>
 		<dict>
 		<dict>
 			<key>orderHint</key>
 			<key>orderHint</key>
-			<integer>0</integer>
+			<integer>1</integer>
 		</dict>
 		</dict>
 		<key>SwiftTerm.xcscheme_^#shared#^_</key>
 		<key>SwiftTerm.xcscheme_^#shared#^_</key>
 		<dict>
 		<dict>
@@ -27,7 +27,7 @@
 		<key>iOS.xcscheme_^#shared#^_</key>
 		<key>iOS.xcscheme_^#shared#^_</key>
 		<dict>
 		<dict>
 			<key>orderHint</key>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>0</integer>
 		</dict>
 		</dict>
 	</dict>
 	</dict>
 </dict>
 </dict>

+ 4 - 4
SwiftTerm/Sources/SwiftTerm/MacTerminalView.swift

@@ -260,13 +260,13 @@ public class TerminalView: NSView, TerminalDelegate, NSTextInputClient, NSUserIn
 
 
     public func scrollUp (lines: Int)
     public func scrollUp (lines: Int)
     {
     {
-        var newPosition = max (terminal.buffer.yDisp - lines, 0)
+        let newPosition = max (terminal.buffer.yDisp - lines, 0)
         scrollTo (row: newPosition)
         scrollTo (row: newPosition)
     }
     }
     
     
     public func scrollDown (lines: Int)
     public func scrollDown (lines: Int)
     {
     {
-        var newPosition = min (terminal.buffer.yDisp + lines, terminal.buffer.lines.count - terminal.rows);
+        let newPosition = min (terminal.buffer.yDisp + lines, terminal.buffer.lines.count - terminal.rows);
         scrollTo (row: newPosition);
         scrollTo (row: newPosition);
     }
     }
 
 
@@ -340,7 +340,7 @@ public class TerminalView: NSView, TerminalDelegate, NSTextInputClient, NSUserIn
             font = fontNormal
             font = fontNormal
         }
         }
         
         
-        var fgColor = mapColor (color: Int (fg), isFg: true)
+        let fgColor = mapColor (color: Int (fg), isFg: true)
         var nsattr: [NSAttributedString.Key:Any] = [
         var nsattr: [NSAttributedString.Key:Any] = [
             .font: font,
             .font: font,
             .foregroundColor: fgColor,
             .foregroundColor: fgColor,
@@ -421,7 +421,7 @@ public class TerminalView: NSView, TerminalDelegate, NSTextInputClient, NSUserIn
         let tb = terminal.buffer
         let tb = terminal.buffer
         
         
         for row in rowStart...rowEnd {
         for row in rowStart...rowEnd {
-            let line = terminal.buffer.lines [row + tb.yDisp] ?? terminal.buffer.getBlankLine(attribute: CharData.defaultAttr)
+            let line = terminal.buffer.lines [row + tb.yDisp] 
             buffer [row + tb.yDisp] = buildAttributedString (line: line, cols: cols, prefix: "")
             buffer [row + tb.yDisp] = buildAttributedString (line: line, cols: cols, prefix: "")
             // print ("Updating \(row) - \(line)")
             // print ("Updating \(row) - \(line)")
         }
         }

+ 2 - 6
SwiftTerm/Sources/SwiftTerm/Terminal.swift

@@ -463,7 +463,7 @@ public class Terminal {
         {
         {
             var newPutback: [UInt8] = [code]
             var newPutback: [UInt8] = [code]
             let left = bytesLeft()
             let left = bytesLeft()
-            for x in 0..<left {
+            for _ in 0..<left {
                 newPutback.append (getNext ())
                 newPutback.append (getNext ())
             }
             }
             putbackBuffer = newPutback
             putbackBuffer = newPutback
@@ -501,9 +501,6 @@ public class Terminal {
         var bufferRow = buffer.lines [buffer.y + buffer.yBase]
         var bufferRow = buffer.lines [buffer.y + buffer.yBase]
 
 
         updateRange (buffer.y)
         updateRange (buffer.y)
-        let left = readingBuffer.bytesLeft()
-        var idx = readingBuffer.idx
-        var copy = readingBuffer.putbackBuffer
         while readingBuffer.hasNext() {
         while readingBuffer.hasNext() {
             var ch: Character = " "
             var ch: Character = " "
             var chWidth: Int = 0
             var chWidth: Int = 0
@@ -533,7 +530,7 @@ public class Terminal {
                 }
                 }
                 
                 
                 if chSet == false {
                 if chSet == false {
-                    let rune = UnicodeScalar (code) ?? UnicodeScalar (32)!
+                    let rune = UnicodeScalar (code)
                     chWidth = UnicodeUtil.columnWidth(rune: rune)
                     chWidth = UnicodeUtil.columnWidth(rune: rune)
                     ch = Character (rune)
                     ch = Character (rune)
                 }
                 }
@@ -2838,7 +2835,6 @@ public class Terminal {
     {
     {
         // TODO
         // TODO
         abort ()
         abort ()
-        return 0
     }
     }
     
     
     var terminalTitle: String = ""              // The Xterm terminal title
     var terminalTitle: String = ""              // The Xterm terminal title