Skip to content

Commit 0465d8e

Browse files
committed
Fix SPC insertion being affected by previous prefix argument
After mazegaki conversion has been used once, inserting a space character (SPC) becomes affected by the prefix argument of the previous command, rather than the current one. When mazegaki conversion is used for the first time, `tc-mazegaki.el` adds a binding for SPC to `tcode-mode-map`. Thereafter, typing SPC is handled by `tcode-input-method`, which executes the command `tcode-mazegaki-space-or-convert` with the value of `current-prefix-arg` as its prefix argument. This issue occurs when `tcode-use-input-method` is non-`nil`. Changing this variable affects when `tcode-input-method` is invoked. When the value is `nil`, the function is called from `tcode-self-insert-command`, at which point `current-prefix-arg` correctly represents the prefix argument for `tcode-self-insert-command`, so it is appropriate to pass it along to the subcommand. However, when `tcode-use-input-method` is non-`nil`, `tcode-input-method` is invoked directly from the event loop, at a time when no command is currently executing. In that case, `current-prefix-arg` still holds the prefix argument from the previous command, so using it for the subcommand is incorrect. Use `prefix-argument` instead when `tcode-use-input-method` is non-`nil`.
1 parent a67b2d9 commit 0465d8e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tc.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,9 @@ t ... cancel"
663663
(if (commandp action)
664664
(progn
665665
;; コマンドの実行
666-
(setq prefix-arg current-prefix-arg
667-
this-command action)
666+
(unless tcode-use-input-method
667+
(setq prefix-arg current-prefix-arg))
668+
(setq this-command action)
668669
(command-execute action))
669670
;; コマンドでない関数の実行
670671
(funcall action)

0 commit comments

Comments
 (0)