improve restore of scrollback

This commit is contained in:
neon443
2025-07-04 17:37:06 +01:00
parent 6ce6f5c823
commit c9c1d152ca
2 changed files with 10 additions and 7 deletions

View File

@@ -23,10 +23,6 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
print(getTerminal().foregroundColor.colorCodable) print(getTerminal().foregroundColor.colorCodable)
applySelectedTheme() applySelectedTheme()
Task {
await startFeedLoop()
}
} }
func restoreScrollback() async { func restoreScrollback() async {
@@ -74,6 +70,16 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
// TODO: selectedtext and cursor colors // TODO: selectedtext and cursor colors
} }
override func didMoveToWindow() {
super.didMoveToWindow()
if window != nil {
Task {
await restoreScrollback()
await startFeedLoop()
}
}
}
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
terminalDelegate = self terminalDelegate = self

View File

@@ -19,9 +19,6 @@ struct TerminalController: UIViewRepresentable {
func makeUIView(context: Context) -> TerminalView { func makeUIView(context: Context) -> TerminalView {
if let sessionID = handler.sessionID { if let sessionID = handler.sessionID {
if let existing = container.sessions[sessionID] { if let existing = container.sessions[sessionID] {
Task {
await existing.terminalView.restoreScrollback()
}
return existing.terminalView return existing.terminalView
} }
} }