[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6db3d54 024/167: ivy.el (ivy--insert-prompt): Use newlines
From: |
Oleh Krehel |
Subject: |
[elpa] master 6db3d54 024/167: ivy.el (ivy--insert-prompt): Use newlines instead of truncation |
Date: |
Tue, 08 Dec 2015 10:49:40 +0000 |
branch: master
commit 6db3d543cd277147886fec70658a0477ca83fb6f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy--insert-prompt): Use newlines instead of truncation
When the prompt string is longer than window-width, insert newlines
appropriately so that the whole prompt fits in the window without
scrolling. Finally, when prompt+entered text would be larger than
window-width, reformat the prompt so that entered text starts on a
newline. When completing file names, move the whole path to a new line
in that case.
Fixes #252
---
ivy.el | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/ivy.el b/ivy.el
index 7885a9c..73ebbfa 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1342,17 +1342,21 @@ Insert .* between each char."
ivy--full-length)
ivy--length)))
ivy--prompt-extra
- tail)
- (if ivy--directory
- (abbreviate-file-name ivy--directory)
- ""))))
+ tail)))
+ (d-str (if ivy--directory
+ (abbreviate-file-name ivy--directory)
+ "")))
(save-excursion
(goto-char (point-min))
(delete-region (point-min) (minibuffer-prompt-end))
- (when (> (length n-str) (- (window-width) 35))
- (setq n-str (concat (substring n-str 0
- (max (- (window-width) 35)
- 10)) "... ")))
+ (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 ((regex (format "\\([^\n]\\{%d\\}\\)[^\n]" (window-width))))
+ (while (string-match regex n-str)
+ (setq n-str (replace-match (concat (match-string 1 n-str) "\n")
nil t n-str 1))))
(set-text-properties 0 (length n-str)
`(face minibuffer-prompt ,@std-props)
n-str)
- [elpa] master 3146501 010/167: ivy.el (ivy-resume): Don't regexp-quote preselect, (continued)
- [elpa] master 3146501 010/167: ivy.el (ivy-resume): Don't regexp-quote preselect, Oleh Krehel, 2015/12/08
- [elpa] master f04aec8 009/167: ivy-hydra.el: Bind "t" to toggle-truncate-lines, Oleh Krehel, 2015/12/08
- [elpa] master 82a317c 011/167: Make swiper compatible with visual-line-mode, Oleh Krehel, 2015/12/08
- [elpa] master 45b54e3 015/167: counsel.el (counsel--gg-count): Fix for "'" in query, Oleh Krehel, 2015/12/08
- [elpa] master 6bf3239 006/167: ivy.el (ivy-yank-word): Add only one space each time, Oleh Krehel, 2015/12/08
- [elpa] master 73e5799 012/167: Fix counsel-git-grep not updating to 0 candidates, Oleh Krehel, 2015/12/08
- [elpa] master dfb41d0 016/167: Implement ivy-avy, Oleh Krehel, 2015/12/08
- [elpa] master eda091b 017/167: Customize ivy-avy and fix compile warnings, Oleh Krehel, 2015/12/08
- [elpa] master fa49a81 018/167: Fix "End of buffer" for swiper and visual-line-mode, Oleh Krehel, 2015/12/08
- [elpa] master 1714220 022/167: swiper.el (swiper-font-lock-ensure): Exclude help-mode, Oleh Krehel, 2015/12/08
- [elpa] master 6db3d54 024/167: ivy.el (ivy--insert-prompt): Use newlines instead of truncation,
Oleh Krehel <=
- [elpa] master 1c1e6fc 008/167: ivy.el (ivy--reset-state): Less strict on :preselect, Oleh Krehel, 2015/12/08
- [elpa] master c89c167 007/167: Specify shell command for counsel-git-grep with prefix arg, Oleh Krehel, 2015/12/08
- [elpa] master ff077c6 013/167: counsel.el (counsel--gg-candidates): Use counsel-git-grep-cmd, Oleh Krehel, 2015/12/08
- [elpa] master cbaa811 014/167: Use forward-line instead of line-move if possible, Oleh Krehel, 2015/12/08
- [elpa] master 4e0c3f1 019/167: swiper-avy: show avy hints in minibuffer as well, Oleh Krehel, 2015/12/08
- [elpa] master 52c9565 020/167: swiper.el (swiper--candidates): Avoid line-move for large buffers, Oleh Krehel, 2015/12/08
- [elpa] master 47a220d 023/167: Support hash tables in ivy-read, Oleh Krehel, 2015/12/08
- [elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic, Oleh Krehel, 2015/12/08
- [elpa] master 126158d 025/167: ivy.el (ivy--filter): Anchor only for swiper, Oleh Krehel, 2015/12/08
- [elpa] master 800e640 028/167: Fix "M-o k" when switching buffers, Oleh Krehel, 2015/12/08