InputHandler // Add sansReading() to generateStateOfInputting().

This commit is contained in:
ShikiSuen 2022-11-25 11:04:40 +08:00
parent 496264f108
commit 8043bd683c
2 changed files with 9 additions and 3 deletions

View File

@ -28,11 +28,17 @@ public protocol InputHandlerProtocol {
func clearComposerAndCalligrapher()
func ensureKeyboardParser()
func handleEvent(_ event: NSEvent) -> Bool
func generateStateOfInputting() -> IMEStateProtocol
func generateStateOfInputting(sansReading: Bool) -> IMEStateProtocol
func generateStateOfAssociates(withPair pair: Megrez.Compositor.KeyValuePaired) -> IMEStateProtocol
func consolidateNode(candidate: (String, String), respectCursorPushing: Bool, preConsolidate: Bool)
}
extension InputHandlerProtocol {
func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol {
generateStateOfInputting(sansReading: sansReading)
}
}
// MARK: - (Delegate).
/// InputHandler

View File

@ -18,12 +18,12 @@ extension InputHandler {
// MARK: - State Building
///
public func generateStateOfInputting() -> IMEStateProtocol {
public func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol {
/// (Update the composing buffer)
/// IMEStateData NSAttributeString
var displayTextSegments: [String] = compositor.walkedNodes.values
var cursor = convertCursorForDisplay(compositor.cursor)
let reading: String = readingForDisplay //
let reading: String = sansReading ? "" : readingForDisplay //
if !reading.isEmpty {
var newDisplayTextSegments = [String]()
var temporaryNode = ""