emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 9b13aa4 170/348: ivy.el (ivy-flip): Allow to flip candidat


From: Oleh Krehel
Subject: [elpa] master 9b13aa4 170/348: ivy.el (ivy-flip): Allow to flip candidates/input
Date: Sat, 8 Apr 2017 11:03:49 -0400 (EDT)

branch: master
commit 9b13aa466e3370b52e536c7c1a290d924d488ee9
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-flip): Allow to flip candidates/input
    
    * ivy.el (ivy--insert-minibuffer): Update.
    
    Fixes #663
---
 ivy.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index ed5eed5..575e7af 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2213,6 +2213,11 @@ Should be run via minibuffer `post-command-hook'."
           (ivy--filter ivy-text ivy--all-candidates))))
       (setq ivy--old-text ivy-text))))
 
+(defvar ivy-flip (and (require 'lv nil t)
+                      nil)
+  "When non-nil, the candidates are above the input, instead of below.
+This depends on `lv' feature provided by the package `hydra'.")
+
 (defun ivy--insert-minibuffer (text)
   "Insert TEXT into minibuffer with appropriate cleanup."
   (let ((resize-mini-windows nil)
@@ -2225,10 +2230,13 @@ Should be run via minibuffer `post-command-hook'."
     (ivy--insert-prompt)
     ;; Do nothing if while-no-input was aborted.
     (when (stringp text)
-      (let ((buffer-undo-list t))
-        (save-excursion
-          (forward-line 1)
-          (insert text))))
+      (if ivy-flip
+          (let ((lv-force-update t))
+            (lv-message (substring text 1)))
+        (let ((buffer-undo-list t))
+          (save-excursion
+            (forward-line 1)
+            (insert text)))))
     (when (display-graphic-p)
       (ivy--resize-minibuffer-to-fit))
     ;; prevent region growing due to text remove/add



reply via email to

[Prev in Thread] Current Thread [Next in Thread]