Carry a display/insert split through completion so command suggestions show r2's help text via the native secondary title, and complete command arguments against eval vars and flagspaces in addition to flags. Recall the language alongside the code when cycling history, and keep r2 output's leading whitespace intact. Persist the REPL draft and active language per session in SessionUIState so they survive reopening the project. Defer the input field's first-responder change out of the view update.
18 lines
479 B
Swift
18 lines
479 B
Swift
import Foundation
|
|
|
|
public struct REPLCompletion: Sendable, Equatable {
|
|
public let insertText: String
|
|
public let displayText: String
|
|
public let detailText: String?
|
|
|
|
public init(insertText: String, displayText: String, detailText: String? = nil) {
|
|
self.insertText = insertText
|
|
self.displayText = displayText
|
|
self.detailText = detailText
|
|
}
|
|
|
|
public init(_ text: String) {
|
|
self.init(insertText: text, displayText: text)
|
|
}
|
|
}
|