Fix command-line SKK cancel flow so <Esc>/<C-g> abort composition instead of confirming#269
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/vim-skk/eskk.vim/sessions/284b0c67-c4ff-45ef-b502-54fdc19f6cc9 Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix command-line mode input cancellation in SKK
Fix command-line SKK cancel flow so May 10, 2026
<Esc>/<C-g> abort composition instead of confirming
Shougo
approved these changes
May 10, 2026
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.
In command-line mode, in-progress SKK composition (e.g.
:▽ああ) could not be aborted mid-entry:<Esc>and<C-g>ended up leaving composed text on the command line and triggering invalid command execution. This change adjusts command-line cancellation flow so active composition is discarded before exiting cmdline editing state.Command-line
<Esc>now follows cancel semantics during active compositions:asym_filter(),<Esc>is routed tos:do_cancel()(nots:do_escape()) when mode iscand preedit is non-empty.Cancel path now clears preedit state before cmdline escape
s:do_cancel(), cmdline-mode handling now:\<Esc>as a post-rewrite keyああ/▽ああfrom the cmdline rather than confirming it.Scope control
Original prompt
Fix issue #268 in
vim-skk/eskk.vim: command-line mode input cannot be cancelled mid-entry.Issue: #268
Problem summary:
In command-line mode, when the user is in an in-progress SKK input state such as
:▽ああ, pressing<ESC>or<C-g>incorrectly confirms the input instead of cancelling it.Current broken behavior reported in the issue:
<ESC>results in"エディタのコマンドではありません:ああ"<C-G>results in"エデ��タのコマンドではありません:▽ああ"Expected behavior:
<ESC>and/or<C-g>should cancel the in-progress composition rather than committing text to the command line.Implementation guidance:
:command-line editing), not just candidate-selection (phase:henkan-select) behavior.Acceptance criteria:
ああor▽ああas a command.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: @vim-skk/eskk.vim/pull/266 このプルリクエストをチェックしてください
Assistant: 結論: 大きな設計方針は良く、機能追加として妥当ですが、現時点では 1 点気になる挙動があるので「その確認が取れるまでは approve は保留」が安全です。
特に
back-to-henkanの復帰処理が、候補選択前の入力状態を正確に再現できるかを確認したいです。PR サマリー
mergeable_state = cleanこの PR の意図は明確です。
候補一覧表示 (
phase:henkan-select) 中のキャンセル操作を固定の<C-g>にせず、用途別に切り替えられるようにしています。追加された選択肢は次の 3 つです。
phase:henkan-select:escape従来動作
phase:henkan-select:back-to-henkan変換前の
▽ひらがな相当へ戻すphase:henkan-select:clear入力をクリアする
コア変更
この PR の中心は 2 つです。
マッピング定義の拡張
autoload/eskk.vimでphase:henkan-select向けにclearback-to-henkanを追加
候補選択中の入力処理分岐の追加
autoload/eskk/dictionary.vimの候補選択プロンプトで、をそれぞれ別動作に分岐
加えて、
doc/eskk.jaxに FAQ 形式で設定例が追加されていて、ユーザー向けの導線もあります。小さな機能追加としてまとまりは良いです。
変更点レビュー
1. マップ定義の追加は自然
autoload/eskk.vimでは、既存のphase:henkan-select:*の流れに沿って新しいキー種別を足しており、拡張の仕方として自然です。また各モードの
MODE_LOCAL_KEYSにも追加されているため、設定として露出させる経路は揃っています。この部分は問題なさそうです。
2. 候補一覧中の escape / clear 分岐は分かりやすい
autoload/eskk/dictionary.vim側では、従来の固定<C-g>判定をやめて、ユーザー設定された lhs を見ています。その後の分岐も意図が明快です。