feat: direct入力状態からabbrevモードを一時的に使うabbrevFromDirect APIを追加#243
Open
yoshphys wants to merge 3 commits intovim-skk:mainfrom
Open
feat: direct入力状態からabbrevモードを一時的に使うabbrevFromDirect APIを追加#243yoshphys wants to merge 3 commits intovim-skk:mainfrom
yoshphys wants to merge 3 commits intovim-skk:mainfrom
Conversation
cancel()はinitializeState()を直接呼んでいたため、state.modeは
"direct"にリセットされるがmodeChange()は呼ばれず、context.mode
(およびvim.g["skkeleton#mode"])が"abbrev"のまま残るバグがあった。
initializeStateWithAbbrev()を使うよう変更することで、abbrevモードから
抜ける際にmodeChange("hira")が呼ばれ、表示上のモードが正しく同期される。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
skkeleton無効(direct入力)状態から直接abbrevモードに入り、
変換確定またはキャンセル後に自動的にdisableに戻る機能を追加する。
実装内容:
- Context.onAbbrevDone: abbrevセッション完了時のコールバックフィールドを追加
- initializeStateWithAbbrev(): onAbbrevDoneがある場合はmodeChange("hira")を
スキップしてコールバックを実行(hiraへの一瞬の遷移を防ぐ)
- abbrevFromDirect(): enable後にabbrevモードに入り、onAbbrevDoneにdisableを設定
- handle()にaabbrevFromDirectルーティングを追加
- completeCallback(): ddc経由での確定時もonAbbrevDoneを処理
使用例:
vim.fn["skkeleton#handle"]("abbrevFromDirect", vim.empty_dict())
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
概要
skkeleton無効(direct入力)状態から直接abbrevモードに入り、変換確定またはキャンセル後に自動的にdisableに戻る
abbrevFromDirectAPIを追加します。使用例
実装内容
Context.onAbbrevDone: abbrevセッション完了時のコールバックフィールドを追加。循環依存を避けながらdisable処理を委ねるために使用initializeStateWithAbbrev():onAbbrevDoneがある場合はmodeChange("hira")をスキップしてコールバックを実行(hiraへの一瞬の遷移を防ぐ)abbrevFromDirect(): enableしてからabbrevモードに入り、onAbbrevDoneにskkeleton#disableを設定completeCallback(): ddc経由(<C-y>など)で確定した場合もonAbbrevDoneを処理(<C-y>はskkeletonのmapped_keysに含まれないため必要)henkanInput(): abbrevFromDirectセッション中に変換候補を確定させるキーを入力した際、handleKey経由でkanaテーブルに通さず直接出力する。kakutei内でonAbbrevDone(skkeleton#disable)が呼ばれた後にキーがkana変換されてしまう問題を修正依存
このPRはfix #242(
cancel()のバグフィックス)に依存しています。