From 76ed94678120625705f5bfa87ccd81baf568dbef Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:10:29 +0100 Subject: [PATCH] FINALLYYYYY fix wierd keyboard bug --- Config.xcconfig | 2 +- .../Views/Terminal/SSHTerminalDelegate.swift | 2 +- ShhShell/Views/Terminal/ShellTabView.swift | 21 ++++++++----------- ShhShell/Views/Terminal/ShellView.swift | 11 ++-------- .../Views/Terminal/TerminalController.swift | 16 +++++++------- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/Config.xcconfig b/Config.xcconfig index 713f7d5..91f175e 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -5,7 +5,7 @@ // Created by neon443 on 06/06/2025. // -VERSION = 1.5.1 +VERSION = 1.5.3 BUILD = 51 // Configuration settings file format documentation can be found at: diff --git a/ShhShell/Views/Terminal/SSHTerminalDelegate.swift b/ShhShell/Views/Terminal/SSHTerminalDelegate.swift index 23db00f..52383d7 100644 --- a/ShhShell/Views/Terminal/SSHTerminalDelegate.swift +++ b/ShhShell/Views/Terminal/SSHTerminalDelegate.swift @@ -88,7 +88,7 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina required init?(coder: NSCoder) { fatalError("unimplemented") } - + nonisolated public func scrolled(source: TerminalView, position: Double) {} nonisolated public func setTerminalTitle(source: TerminalView, title: String) { diff --git a/ShhShell/Views/Terminal/ShellTabView.swift b/ShhShell/Views/Terminal/ShellTabView.swift index 6a7c4cc..06423d3 100644 --- a/ShhShell/Views/Terminal/ShellTabView.swift +++ b/ShhShell/Views/Terminal/ShellTabView.swift @@ -147,22 +147,19 @@ struct ShellTabView: View { .id(selectedID) .transition(.opacity) } else { - Text("No Session") + if let handler { + ShellView( + handler: handler, + hostsManager: hostsManager + ) .onAppear { if selectedID == nil { - guard let handler, - let handlerID = handler.sessionID else { return } - selectedID = handlerID - container.sessions[handlerID] = TerminalContainer( - handler: handler, - terminalView: SSHTerminalDelegate( - frame: CGRect(origin: CGPoint(x: 0, y: 0), size: .zero), - handler: handler, - hostsManager: hostsManager - ) - ) + selectedID = handler.sessionID } } + } else { + Text("No Session") + } } } } diff --git a/ShhShell/Views/Terminal/ShellView.swift b/ShhShell/Views/Terminal/ShellView.swift index fa496fe..2bcf304 100644 --- a/ShhShell/Views/Terminal/ShellView.swift +++ b/ShhShell/Views/Terminal/ShellView.swift @@ -15,19 +15,12 @@ struct ShellView: View { @Environment(\.dismiss) var dismiss - var body: some View { + var body: some View { NavigationStack { ZStack { hostsManager.selectedTheme.background.suiColor .ignoresSafeArea(.all) TerminalController(handler: handler, hostsManager: hostsManager) -// .onAppear { -// if let sessionID = handler.sessionID { -// Task { -// await container.sessions[sessionID]?.terminalView.restoreScrollback() -// } -// } -// } Group { Color.gray.opacity(0.2) @@ -42,7 +35,7 @@ struct ShellView: View { handler.applySelectedTheme() } } - } + } } #Preview { diff --git a/ShhShell/Views/Terminal/TerminalController.swift b/ShhShell/Views/Terminal/TerminalController.swift index d43479c..f65f5ad 100644 --- a/ShhShell/Views/Terminal/TerminalController.swift +++ b/ShhShell/Views/Terminal/TerminalController.swift @@ -31,14 +31,14 @@ struct TerminalController: UIViewRepresentable { tv.translatesAutoresizingMaskIntoConstraints = false tv.autoresizingMask = [.flexibleWidth, .flexibleHeight] -// if let sessionID = handler.sessionID { -// Task { @MainActor in -// container.sessions[sessionID] = TerminalContainer( -// handler: handler, -// terminalView: tv -// ) -// } -// } + if let sessionID = handler.sessionID { + Task { @MainActor in + container.sessions[sessionID] = TerminalContainer( + handler: handler, + terminalView: tv + ) + } + } return tv }