]> code.delx.au - gnu-emacs-elpa/commitdiff
Truncate minibuffer prompts longer than window-width
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Sep 2015 11:56:19 +0000 (13:56 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Sep 2015 11:56:19 +0000 (13:56 +0200)
* ivy.el (ivy--insert-prompt): When the prompt string is longer than the
  window width, truncate it to window width minus 26 chars.

Fixes #240

ivy.el

diff --git a/ivy.el b/ivy.el
index bfec0fe27b6101413b4d0756d17ca4025dcd4510..dc17faaa74d599db7611cc354beb9645f43a5373 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1294,6 +1294,8 @@ Insert .* between each char."
         (save-excursion
           (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)) "... ")))
           (set-text-properties 0 (length n-str)
                                `(face minibuffer-prompt ,@std-props)
                                n-str)