branch: master
commit f180451217277e63b067aa3d06d5af69140e320d
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
swiper.el (swiper-all): Fix window-width in -nw
* swiper.el (swiper-window-width): New defvar. Dynamically rebound to
current frame width.
(swiper-all): Avoid continuation lines for emacs -nw.
---
swiper.el | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/swiper.el b/swiper.el
index d247460..43c3c43 100644
--- a/swiper.el
+++ b/swiper.el
@@ -786,8 +786,10 @@ Run `swiper' for those buffers."
(list "")
(setq ivy--old-cands (nreverse cands))))))
+(defvar swiper-window-width 80)
+
(defun swiper--all-format-function (cands)
- (let* ((ww (window-width))
+ (let* ((ww swiper-window-width)
(col2 1)
(cands-with-buffer
(mapcar (lambda (s)
@@ -825,7 +827,8 @@ Run `swiper' for those buffers."
(defun swiper-all ()
"Run `swiper' for all opened buffers."
(interactive)
- (let ((ivy-format-function #'swiper--all-format-function))
+ (let* ((swiper-window-width (- (frame-width) (if (display-graphic-p) 0 1)))
+ (ivy-format-function #'swiper--all-format-function))
(ivy-read "swiper-all: " 'swiper-all-function
:action 'swiper-all-action
:unwind #'swiper--cleanup