Fix trapped-in-prompt cursor issue in minibuffer

This commit is contained in:
Henrik Lissner 2018-05-17 12:11:19 +02:00
parent 022baf808c
commit 4fba57e954
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -374,12 +374,11 @@ from the default."
;;
(defun doom*silence-motion-errors (orig-fn &rest args)
(if (and (minibufferp)
(<= (point) (minibuffer-prompt-end)))
(progn
(ignore-errors (apply orig-fn args))
(goto-char (minibuffer-prompt-end)))
(apply orig-fn args)))
(if (not (minibufferp))
(apply orig-fn args)
(ignore-errors (apply orig-fn args))
(when (<= (point) (minibuffer-prompt-end))
(goto-char (minibuffer-prompt-end)))))
(advice-add #'left-char :around #'doom*silence-motion-errors)
(advice-add #'right-char :around #'doom*silence-motion-errors)