fix(input): XPC入力を同期化し、入力モード同期とセッション寿命を修正 - #374
Open
ensan-hcl wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
ConverterServer との XPC 通信を維持しながら、キー処理を同期化し、入力モードとセッション管理の不整合を修正します。目的は、ホストアプリへの入力反映の遅れや、日本語モードなのに英字が直接入力される経路を解消することです。
変更内容
1. キー処理とホストアプリへの反映を同期化
handleの消費判定を返します。候補選択・確定操作も同期的に反映します。2. 入力モードは送信直前の値を使用
従来は「英数で activate → 日本語に切替 → 最初のキー」の順で、保存済みの古い英数モードが Server に再送され、日本語への変更を上書きしていました。
初回キー・再接続時の activation は、送信直前の最新モードと設定から生成します。既存セッションのモード変更は同期的に反映し、無関係な
setValue通知は無視します。また、未確定文字列がないモード変更では、空の MarkedText による不要な置換を行いません。3. アプリ切替・切断時の状態とセッションを整理
deactivateも送信し、次の activate で古い入力が復活することを防ぎます。通信仕様・互換性
検証と未確認事項
swift test --package-path Core: 88 テスト通過azooKeyMacTests(署名無効): 14 テスト通過git diff --check: 通過実 Server で古い activation による英字の直接挿入を再現し、修正後は日本語の未確定入力になることを検証しています。実 NSXPCConnection を使った同期待機・タイムアウト・セッション回収の回帰テストも含みます。Server を直接テストできるよう、
main.swiftの既存処理は主にConverterServer.swiftへ移動しています。通信失敗したキーをアプリへ通すフォールバックは残ります。 Server 停止中も日本語入力を継続できる設計ではありません。Terminal.app での修正後の実入力、高負荷・長時間稼働は未確認で、報告されている症状すべての解消を保証するものではありません。#358 の暫定 MarkedText 方式は採用していません。