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

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

[elpa] master aea4919 225/348: Shrink ivy back to ivy-height after dispa


From: Oleh Krehel
Subject: [elpa] master aea4919 225/348: Shrink ivy back to ivy-height after dispatching actions.
Date: Sat, 8 Apr 2017 11:04:01 -0400 (EDT)

branch: master
commit aea4919c8e1c3abf9e513b462d64c0ed77c0480e
Author: Yevgnen Koh <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Shrink ivy back to ivy-height after dispatching actions.
    
    Before when there are too many actions, ivy will not go back to
    original ivy-height after a C-g in ivy-dispatching-done or
    performing ivy-dispatching-call. The function
    ivy-shrink-after-dispatching deals with these situations.
---
 ivy.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 1309da6..fb8feed 100644
--- a/ivy.el
+++ b/ivy.el
@@ -567,11 +567,17 @@ selection, non-nil otherwise."
                (setcar actions (1+ action-idx))
                (ivy-set-action actions)))))))
 
+(defun ivy-shrink-after-dispatching ()
+  "Shrink the window after dispatching when action list is too large."
+  (let ((window (selected-window)))
+    (window-resize window (- ivy-height (window-height window)))))
+
 (defun ivy-dispatching-done ()
   "Select one of the available actions and call `ivy-done'."
   (interactive)
   (when (ivy-read-action)
-    (ivy-done)))
+    (ivy-done))
+  (ivy-shrink-after-dispatching))
 
 (defun ivy-dispatching-call ()
   "Select one of the available actions and call `ivy-call'."
@@ -581,7 +587,8 @@ selection, non-nil otherwise."
     (unwind-protect
         (when (ivy-read-action)
           (ivy-call))
-      (ivy-set-action actions))))
+      (ivy-set-action actions)))
+  (ivy-shrink-after-dispatching))
 
 (defun ivy-build-tramp-name (x)
   "Reconstruct X into a path.



reply via email to

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