From 3b0938c0420de2b845e7e8f8fbbb57ddc61718f2 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 22 Jan 2020 14:46:34 +0300 Subject: [PATCH] Render Ido suggestions using an overlay * lisp/ido.el (ido--overlay): New variable. (ido-exhibit): Render with 'after-string' on an overlay (bug#38457). --- lisp/ido.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/ido.el b/lisp/ido.el index 83b88e4e81c..355be5eaa66 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -4492,6 +4492,8 @@ For details of keybindings, see `ido-find-file'." (ido-tidy)) (throw 'ido contents)))) +(defvar ido--overlay nil) + (defun ido-exhibit () "Post command hook for Ido." ;; Find matching files and display a list in the minibuffer. @@ -4726,7 +4728,13 @@ For details of keybindings, see `ido-find-file'." (let ((inf (ido-completions contents))) (setq ido-show-confirm-message nil) (ido-trace "inf" inf) - (insert inf)) + (when ido--overlay + (delete-overlay ido--overlay)) + (let ((o (make-overlay (point-max) (point-max) nil t t))) + (when (> (length inf) 0) + (put-text-property 0 1 'cursor t inf)) + (overlay-put o 'after-string inf) + (setq ido--overlay o))) )))) (defun ido-completions (name) -- 2.39.2