Skip to content

Commit 00f5088

Browse files
authored
Merge pull request #269 from vim-skk/copilot/fix-cancel-input-command-line-mode
Fix command-line SKK cancel flow so `<Esc>`/`<C-g>` abort composition instead of confirming
2 parents 0cb1763 + c1b2de0 commit 00f5088

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

autoload/eskk.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ function! s:asym_filter(stash) abort "{{{
428428
call s:do_cancel(a:stash)
429429
return
430430
elseif char ==# "\<Esc>"
431-
call s:do_escape(a:stash)
431+
if mode() ==# 'c' && !preedit.empty()
432+
call s:do_cancel(a:stash)
433+
else
434+
call s:do_escape(a:stash)
435+
endif
432436
return
433437
endif
434438

@@ -770,7 +774,9 @@ endfunction "}}}
770774
function! s:do_cancel(stash) abort "{{{
771775
let preedit = a:stash.preedit
772776
if mode() ==# 'c'
773-
call preedit.push_filter_pre_char("\<Esc>")
777+
call preedit.set_henkan_phase(g:eskk#preedit#PHASE_NORMAL)
778+
call preedit.clear_all()
779+
call preedit.push_filter_post_char("\<Esc>")
774780
else
775781
call preedit.set_henkan_phase(g:eskk#preedit#PHASE_NORMAL)
776782
call preedit.clear_all()

0 commit comments

Comments
 (0)