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

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

[elpa] master ef3f010 128/348: ivy.el (ivy--insert-prompt): Improve the


From: Oleh Krehel
Subject: [elpa] master ef3f010 128/348: ivy.el (ivy--insert-prompt): Improve the extra "\n" logic
Date: Sat, 8 Apr 2017 11:03:41 -0400 (EDT)

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

    ivy.el (ivy--insert-prompt): Improve the extra "\n" logic
    
    * ivy.el (ivy--insert-prompt): Update.
---
 ivy.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8034739..aa32186 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2044,11 +2044,16 @@ The returned value should be the updated PROMPT.")
         (save-excursion
           (goto-char (point-min))
           (delete-region (point-min) (minibuffer-prompt-end))
-          (if (> (+ (mod (+ (length n-str) (length d-str)) (window-width))
-                    (length ivy-text))
-                 (window-width))
-              (setq n-str (concat n-str "\n" d-str))
-            (setq n-str (concat n-str d-str)))
+          (let ((len-n (length n-str))
+                (len-d (length d-str))
+                (ww (window-width)))
+            (setq n-str
+                  (cond ((> (+ len-n len-d) ww)
+                         (concat n-str "\n" d-str "\n"))
+                        ((> (+ len-n len-d (length ivy-text)) ww)
+                         (concat n-str d-str "\n"))
+                        (t
+                         (concat n-str d-str)))))
           (when ivy-add-newline-after-prompt
             (setq n-str (concat n-str "\n")))
           (let ((regex (format "\\([^\n]\\{%d\\}\\)[^\n]" (window-width))))



reply via email to

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