native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #62 from supabitapp/gentle-otter

Add drag-and-drop paste to terminal

authored by

khoi and committed by
GitHub
694c22a4 25d56400

+31 -1
+1 -1
supacode/Infrastructure/Ghostty/GhosttyRuntime.swift
··· 362 362 extension NSPasteboard { 363 363 private static let ghosttyEscapeCharacters = "\\ ()[]{}<>\"'`!#$&;|*?\t" 364 364 365 - private static func ghosttyEscape(_ str: String) -> String { 365 + static func ghosttyEscape(_ str: String) -> String { 366 366 var result = str 367 367 for char in ghosttyEscapeCharacters { 368 368 result = result.replacing(String(char), with: "\\\(char)")
+30
supacode/Infrastructure/Ghostty/GhosttySurfaceView.swift
··· 63 63 GHOSTTY_MOUSE_SHAPE_S_RESIZE, 64 64 GHOSTTY_MOUSE_SHAPE_NS_RESIZE, 65 65 ] 66 + private static let dropTypes: Set<NSPasteboard.PasteboardType> = [ 67 + .string, 68 + .fileURL, 69 + .URL, 70 + ] 66 71 67 72 override var acceptsFirstResponder: Bool { true } 68 73 ··· 84 89 wantsLayer = true 85 90 bridge.surfaceView = self 86 91 createSurface() 92 + registerForDraggedTypes(Array(Self.dropTypes)) 87 93 } 88 94 89 95 required init?(coder: NSCoder) { ··· 936 942 return flags 937 943 } 938 944 945 + } 946 + 947 + extension GhosttySurfaceView { 948 + override func draggingEntered(_ sender: any NSDraggingInfo) -> NSDragOperation { 949 + guard let types = sender.draggingPasteboard.types else { return [] } 950 + if Set(types).isDisjoint(with: Self.dropTypes) { 951 + return [] 952 + } 953 + return .copy 954 + } 955 + 956 + override func performDragOperation(_ sender: any NSDraggingInfo) -> Bool { 957 + let pasteboard = sender.draggingPasteboard 958 + 959 + guard let content = pasteboard.getOpinionatedStringContents(), !content.isEmpty else { 960 + return false 961 + } 962 + 963 + let selectionPasteboard = NSPasteboard.ghosttySelection 964 + selectionPasteboard.clearContents() 965 + selectionPasteboard.setString(content, forType: .string) 966 + performBindingAction("paste_from_selection") 967 + return true 968 + } 939 969 } 940 970 941 971 extension GhosttySurfaceView: NSTextInputClient {