Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daehwannam opened this issue Sep 2, 2024 · 0 comments

Comments

@daehwannam
Copy link

daehwannam commented Sep 2, 2024

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant