working on a miniterminalview :yay:

for stuff like static previews of how shit should look
 - eg cursor style previews
 - terminal effect shader previews
This commit is contained in:
neon443
2025-08-23 17:14:28 +01:00
parent a5563731f0
commit 7b4da73ffa
4 changed files with 75 additions and 2 deletions

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import SwiftTerm
struct SettingsView: View {
@ObservedObject var hostsManager: HostsManager
@@ -37,6 +38,9 @@ struct SettingsView: View {
}
.pickerStyle(.segmented)
ForEach(CursorShape.allCases, id: \.self) { type in
}
Picker("Cursor", selection: $hostsManager.settings.cursorType.cursorShape) {
ForEach(CursorShape.allCases, id: \.self) { type in
Text(type.description).tag(type)

View File

@@ -0,0 +1,63 @@
//
// MiniTerminalDelegate.swift
// ShhShell
//
// Created by neon443 on 23/08/2025.
//
import Foundation
import UIKit
import SwiftUI
import SwiftTerm
@MainActor
class MiniTerminalDelegate: TerminalView, TerminalViewDelegate {
nonisolated public func sizeChanged(source: TerminalView, newCols: Int, newRows: Int) {
<#code#>
}
nonisolated public func setTerminalTitle(source: TerminalView, title: String) {
<#code#>
}
nonisolated public func hostCurrentDirectoryUpdate(source: TerminalView, directory: String?) {
<#code#>
}
nonisolated public func send(source: TerminalView, data: ArraySlice<UInt8>) {
<#code#>
}
nonisolated public func scrolled(source: TerminalView, position: Double) {
<#code#>
}
nonisolated public func requestOpenLink(source: SwiftTerm.TerminalView, link: String, params: [String : String]) {
<#code#>
}
nonisolated public func bell(source: TerminalView) {
<#code#>
}
nonisolated public func clipboardCopy(source: SwiftTerm.TerminalView, content: Data) {
<#code#>
}
nonisolated public func iTermContent (source: TerminalView, content: ArraySlice<UInt8>) {
<#code#>
}
nonisolated public func rangeChanged(source: SwiftTerm.TerminalView, startY: Int, endY: Int) {
<#code#>
}
public convenience required override init(frame: CGRect) {
self.init(frame: .zero)
}
public convenience required init?(coder: NSCoder) {
fatalError("unimplememented")
}
}

View File

@@ -31,8 +31,10 @@ final class SSHTerminalDelegate: TerminalView, Sendable, @preconcurrency Termina
applySelectedTheme()
applyScrollbackLength()
applyCursorType()
startFeedLoop()
self.becomeFirstResponder()
// DispatchQueue.main.asyncAfter(deadline: .now()+0.01) {
self.startFeedLoop()
let _ = self.becomeFirstResponder()
// }
}
}