InputHandler // Add sansReading() to generateStateOfInputting().
This commit is contained in:
parent
496264f108
commit
8043bd683c
|
@ -28,11 +28,17 @@ public protocol InputHandlerProtocol {
|
||||||
func clearComposerAndCalligrapher()
|
func clearComposerAndCalligrapher()
|
||||||
func ensureKeyboardParser()
|
func ensureKeyboardParser()
|
||||||
func handleEvent(_ event: NSEvent) -> Bool
|
func handleEvent(_ event: NSEvent) -> Bool
|
||||||
func generateStateOfInputting() -> IMEStateProtocol
|
func generateStateOfInputting(sansReading: Bool) -> IMEStateProtocol
|
||||||
func generateStateOfAssociates(withPair pair: Megrez.Compositor.KeyValuePaired) -> IMEStateProtocol
|
func generateStateOfAssociates(withPair pair: Megrez.Compositor.KeyValuePaired) -> IMEStateProtocol
|
||||||
func consolidateNode(candidate: (String, String), respectCursorPushing: Bool, preConsolidate: Bool)
|
func consolidateNode(candidate: (String, String), respectCursorPushing: Bool, preConsolidate: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension InputHandlerProtocol {
|
||||||
|
func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol {
|
||||||
|
generateStateOfInputting(sansReading: sansReading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - 委任協定 (Delegate).
|
// MARK: - 委任協定 (Delegate).
|
||||||
|
|
||||||
/// InputHandler 委任協定
|
/// InputHandler 委任協定
|
||||||
|
|
|
@ -18,12 +18,12 @@ extension InputHandler {
|
||||||
// MARK: - 構築狀態(State Building)
|
// MARK: - 構築狀態(State Building)
|
||||||
|
|
||||||
/// 生成「正在輸入」狀態。相關的內容會被拿給狀態機械用來處理在電腦螢幕上顯示的內容。
|
/// 生成「正在輸入」狀態。相關的內容會被拿給狀態機械用來處理在電腦螢幕上顯示的內容。
|
||||||
public func generateStateOfInputting() -> IMEStateProtocol {
|
public func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol {
|
||||||
/// 「更新內文組字區 (Update the composing buffer)」是指要求客體軟體將組字緩衝區的內容
|
/// 「更新內文組字區 (Update the composing buffer)」是指要求客體軟體將組字緩衝區的內容
|
||||||
/// 換成由此處重新生成的原始資料在 IMEStateData 當中生成的 NSAttributeString。
|
/// 換成由此處重新生成的原始資料在 IMEStateData 當中生成的 NSAttributeString。
|
||||||
var displayTextSegments: [String] = compositor.walkedNodes.values
|
var displayTextSegments: [String] = compositor.walkedNodes.values
|
||||||
var cursor = convertCursorForDisplay(compositor.cursor)
|
var cursor = convertCursorForDisplay(compositor.cursor)
|
||||||
let reading: String = readingForDisplay // 先提出來,減輕運算負擔。
|
let reading: String = sansReading ? "" : readingForDisplay // 先提出來,減輕運算負擔。
|
||||||
if !reading.isEmpty {
|
if !reading.isEmpty {
|
||||||
var newDisplayTextSegments = [String]()
|
var newDisplayTextSegments = [String]()
|
||||||
var temporaryNode = ""
|
var temporaryNode = ""
|
||||||
|
|
Loading…
Reference in New Issue