mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
added miniterminalcontroller
fix miniterminaldelegate moved stuff around
This commit is contained in:
29
ShhShell/Terminal/MiniTerminalController.swift
Normal file
29
ShhShell/Terminal/MiniTerminalController.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MiniTerminalController.swift
|
||||
// ShhShell
|
||||
//
|
||||
// Created by neon443 on 23/08/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import SwiftTerm
|
||||
|
||||
struct MiniTerminalController: UIViewRepresentable {
|
||||
func feed() {
|
||||
|
||||
}
|
||||
|
||||
func makeUIView(context: Context) -> TerminalView {
|
||||
let tv = MiniTerminalDelegate(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: .zero))
|
||||
tv.translatesAutoresizingMaskIntoConstraints = true
|
||||
tv.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
return tv
|
||||
}
|
||||
|
||||
func updateUIView(_ tv: TerminalView, context: Context) {
|
||||
tv.setNeedsLayout()
|
||||
tv.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
@@ -12,49 +12,24 @@ import SwiftTerm
|
||||
|
||||
@MainActor
|
||||
class MiniTerminalDelegate: TerminalView, TerminalViewDelegate {
|
||||
|
||||
nonisolated public func sizeChanged(source: TerminalView, newCols: Int, newRows: Int) {
|
||||
<#code#>
|
||||
func setCursorType(_ style: CursorType) {
|
||||
getTerminal().setCursorStyle(style.stCursorStyle)
|
||||
}
|
||||
|
||||
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#>
|
||||
}
|
||||
nonisolated public func sizeChanged(source: TerminalView, newCols: Int, newRows: Int) {}
|
||||
nonisolated public func setTerminalTitle(source: TerminalView, title: String) {}
|
||||
nonisolated public func hostCurrentDirectoryUpdate(source: TerminalView, directory: String?) {}
|
||||
nonisolated public func send(source: TerminalView, data: ArraySlice<UInt8>) {}
|
||||
nonisolated public func scrolled(source: TerminalView, position: Double) {}
|
||||
nonisolated public func requestOpenLink(source: SwiftTerm.TerminalView, link: String, params: [String : String]) {}
|
||||
nonisolated public func bell(source: TerminalView) {}
|
||||
nonisolated public func clipboardCopy(source: SwiftTerm.TerminalView, content: Data) {}
|
||||
nonisolated public func iTermContent (source: TerminalView, content: ArraySlice<UInt8>) {}
|
||||
nonisolated public func rangeChanged(source: SwiftTerm.TerminalView, startY: Int, endY: Int) {}
|
||||
|
||||
public convenience required override init(frame: CGRect) {
|
||||
self.init(frame: .zero)
|
||||
terminalDelegate = self
|
||||
}
|
||||
|
||||
public convenience required init?(coder: NSCoder) {
|
||||
@@ -39,7 +39,8 @@ struct SettingsView: View {
|
||||
.pickerStyle(.segmented)
|
||||
|
||||
ForEach(CursorShape.allCases, id: \.self) { type in
|
||||
|
||||
MiniTerminalController()
|
||||
|
||||
}
|
||||
Picker("Cursor", selection: $hostsManager.settings.cursorType.cursorShape) {
|
||||
ForEach(CursorShape.allCases, id: \.self) { type in
|
||||
|
||||
Reference in New Issue
Block a user