InputHandler // Add sansReading() to generateStateOfInputting().
This commit is contained in:
parent
496264f108
commit
8043bd683c
|
@ -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 委任協定
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
Loading…
Reference in New Issue