Terminal-Bugfix: In-App-PTY-Terminal im Dracula-Theme, .command-Fallback, ANSI-Parser-Fix, Doku

This commit is contained in:
x3
2026-09-21 22:59:17 +02:00
parent 8fe8c4925e
commit 1828a96a2b
9 changed files with 699 additions and 18 deletions
+16 -4
View File
@@ -3,6 +3,7 @@ import AppKit
struct ContentView: View {
@EnvironmentObject var store: ProfileStore
@StateObject private var terminals = TerminalManager()
@State private var selection: ConnectionProfile.ID?
@State private var openSessions: [ConnectionProfile] = []
@State private var activeSessionID: ConnectionProfile.ID?
@@ -68,7 +69,12 @@ struct ContentView: View {
} else {
TabView(selection: $activeSessionID) {
ForEach(openSessions) { session in
SessionView(profile: session, statusMessage: $statusMessage)
SessionView(
profile: session,
statusMessage: $statusMessage,
term: terminals.session(for: session, key: store.key(for: session)),
onClose: { closeSession(session) }
)
.tag(Optional(session.id))
.tabItem { Text(session.name) }
}
@@ -143,11 +149,10 @@ struct ContentView: View {
openSessions.append(updated)
}
activeSessionID = p.id
let key = store.key(for: p)
switch p.proto {
case .ssh, .sftp:
SSHService.openInTerminal(profile: p, key: key)
statusMessage = "SSH: \(SSHService.sshCommandString(for: p, key: key))"
// In-App-Terminal verbindet automatisch (onAppear) — kein externes Fenster nötig
statusMessage = "SSH-Terminal zu \(p.username)@\(p.host) …"
case .rdp:
RDPService.connect(profile: p)
statusMessage = "RDP zu \(p.host):\(p.port) gestartet."
@@ -157,6 +162,13 @@ struct ContentView: View {
}
}
func closeSession(_ p: ConnectionProfile) {
terminals.close(p)
openSessions.removeAll { $0.id == p.id }
if activeSessionID == p.id { activeSessionID = openSessions.last?.id }
statusMessage = "Sitzung '\(p.name)' geschlossen."
}
func quickConnect() {
// Simple Quick-Connect: nimmt Auswahl oder leeres SSH-Profil
if let p = selectedProfile { connect(p) }