这是indexloc提供的服务,不要输入任何密码
Skip to content

Ivy minibuffer is not updated when tying Korean chracters with the input method 'korean-hangul #3057

@daehwannam

Description

@daehwannam

I had trouble with ivy minibuffer update when typing Korean characters.

For example,
(1) Run (setq default-input-method 'korean-hangul)
(2) Run swiper.
(3) Type "C-\" to execute toggle-input-method.
(4) Type "dkssud" to write a Korean word "안녕".

You can see that the minibuffer is not updated until you type another key such as "<space>" or "C-n", although the word "안녕" occurs in the main buffer such as

안녕하세요.
만나서 반갑습니다.
나중에 연락 할게요.
안녕히 계세요.

However, I've finally found a solution for this problem, and share it.
(1) Copy the latest definition of hangul-insert-character and replace the old one with it.
(2) Modify ivy--minibuffer-setup to update the minibuffer when self-insert-command or hangul-delete-backward-char is called with the "korean-hangul" input method.

(defun self-insert-command--advice-for-korean (&rest args)
  (when (equal current-input-method "korean-hangul")
    (ivy--queue-exhibit)))

(defun hangul-delete-backward-char--advice-for-korean (&rest args)
  (ivy--queue-exhibit))

(defun ivy--minibuffer-setup--advice-for-korean (&rest args)
  (advice-add 'self-insert-command :after #'self-insert-command--advice-for-korean)
  (advice-add 'hangul-delete-backward-char :after #'hangul-delete-backward-char--advice-for-korean))

(defun ivy--cleanup--advice-for-korean (&rest args)
  (advice-remove 'self-insert-command #'self-insert-command--advice-for-korean)
  (advice-remove 'hangul-delete-backward-char #'hangul-delete-backward-char--advice-for-korean))

(advice-add 'ivy--minibuffer-setup :after #'ivy--minibuffer-setup--advice-for-korean)
(advice-add 'ivy--cleanup :after #'ivy--cleanup--advice-for-korean)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions