]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy--insert-prompt): Avoid negative length error
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Sep 2015 14:42:30 +0000 (16:42 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Sep 2015 14:42:30 +0000 (16:42 +0200)
ivy.el

diff --git a/ivy.el b/ivy.el
index dc17faaa74d599db7611cc354beb9645f43a5373..04c254e8eb1d19df7e6d2912d90b74e0e23660b7 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1295,7 +1295,9 @@ Insert .* between each char."
           (goto-char (point-min))
           (delete-region (point-min) (minibuffer-prompt-end))
           (when (> (length n-str) (window-width))
-            (setq n-str (concat (substring n-str 0 (- (window-width) 30)) "... ")))
+            (setq n-str (concat (substring n-str 0
+                                           (max (- (window-width) 30)
+                                                10)) "... ")))
           (set-text-properties 0 (length n-str)
                                `(face minibuffer-prompt ,@std-props)
                                n-str)