[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cc56ec0 231/399: swiper.el (swiper-isearch-format-function
From: |
Oleh Krehel |
Subject: |
[elpa] master cc56ec0 231/399: swiper.el (swiper-isearch-format-function): Add |
Date: |
Sat, 20 Jul 2019 14:57:29 -0400 (EDT) |
branch: master
commit cc56ec08419a4ddffe4424b301c47edd204f3adf
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper-isearch-format-function): Add
Re #2034
---
swiper.el | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/swiper.el b/swiper.el
index 92e7836..358e2c6 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1301,6 +1301,39 @@ When not running `swiper-isearch' already, start it."
map)
"Keymap for `swiper-isearch'.")
+(defun swiper-isearch-format-function (_cands)
+ (let* ((half-height (/ ivy-height 2))
+ (current (ivy-state-current ivy-last))
+ (i (1- ivy--index))
+ (len 0)
+ res s)
+ (while (and (>= i 0)
+ (string= (nth i ivy--old-cands)
+ current))
+ (cl-decf i))
+ (while (and (>= i 0)
+ (< len half-height))
+ (setq s (nth i ivy--old-cands))
+ (unless (equal s (car res))
+ (push (ivy--format-minibuffer-line s) res)
+ (cl-incf len))
+ (cl-decf i))
+ (setq res (nreverse res))
+ (push (ivy--add-face (ivy--format-minibuffer-line current)
'ivy-current-match) res)
+ (cl-incf len)
+ (setq i (1+ ivy--index))
+ (while (and (< i ivy--length)
+ (string= (nth i ivy--old-cands) current))
+ (cl-incf i))
+ (while (and (< i ivy--length)
+ (< len ivy-height))
+ (setq s (nth i ivy--old-cands))
+ (unless (equal s (car res))
+ (push (ivy--format-minibuffer-line s) res)
+ (cl-incf len))
+ (cl-incf i))
+ (mapconcat #'identity (nreverse res) "\n")))
+
;;;###autoload
(defun swiper-isearch (&optional initial-input)
"A `swiper' that's not line-based."
@@ -1312,6 +1345,7 @@ When not running `swiper-isearch' already, start it."
(let ((ivy-fixed-height-minibuffer t)
(cursor-in-non-selected-windows nil)
(swiper-min-highlight 1)
+ (ivy-format-function #'swiper-isearch-format-function)
res)
(unwind-protect
(and
- [elpa] master 9e513d0 211/399: swiper.el (swiper-thing-at-point): Add, (continued)
- [elpa] master 9e513d0 211/399: swiper.el (swiper-thing-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master ecff164 215/399: ivy.el (ivy-insert-current): Minor simplification, Oleh Krehel, 2019/07/20
- [elpa] master 8a8aea2 219/399: counsel.el (counsel-company): Use company-prefix, Oleh Krehel, 2019/07/20
- [elpa] master fa9acdb 222/399: swiper.el (swiper-isearch-thing-at-point): Add symbol boundaries, Oleh Krehel, 2019/07/20
- [elpa] master 6768214 221/399: ivy.el (ivy--insert-symbol-boundaries): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 2e4f2fb 213/399: Fix grep-occur when using multi-pass re-builders, Oleh Krehel, 2019/07/20
- [elpa] master a9e81f8 220/399: ivy.el: Don't offer virtual buffers for plain switch-to-buffer, Oleh Krehel, 2019/07/20
- [elpa] master 5eea0af 229/399: ivy.el (ivy--minibuffer-index-bounds): Simplify logic, Oleh Krehel, 2019/07/20
- [elpa] master c1ff0d6 228/399: ivy.el: Fix compiler warning, Oleh Krehel, 2019/07/20
- [elpa] master 6ec1126 225/399: ivy.el (ivy-help): Set org-hide-emphasis-markers, Oleh Krehel, 2019/07/20
- [elpa] master cc56ec0 231/399: swiper.el (swiper-isearch-format-function): Add,
Oleh Krehel <=
- [elpa] master 6fd1620 235/399: swiper.el (swiper--recenter-p): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 1d08b29 233/399: swiper.el (swiper-isearch): Ensure font lock, Oleh Krehel, 2019/07/20
- [elpa] master b49f17f 224/399: counsel.el (counsel-ag-function): Add dynamic case folding, Oleh Krehel, 2019/07/20
- [elpa] master e9f0772 218/399: ivy-test.el (counsel-find-file-with-dollars): Adjust, Oleh Krehel, 2019/07/20
- [elpa] master eee9716 236/399: Add open in dired action to counsel-file-jump, Oleh Krehel, 2019/07/20
- [elpa] master fb64ea3 237/399: swiper.el (swiper-mc): Works for swiper-isearch, Oleh Krehel, 2019/07/20
- [elpa] master 39a9e94 232/399: swiper.el (swiper-isearch-current-match): Add, Oleh Krehel, 2019/07/20
- [elpa] master b7574fe 234/399: swiper.el: Extra condition to recenter in terminal, Oleh Krehel, 2019/07/20
- [elpa] master 10755b2 239/399: swiper.el (swiper-isearch-toggle): Add, Oleh Krehel, 2019/07/20
- [elpa] master 38f8e45 242/399: swiper.el (swiper-isearch-toggle): Fix candidate jump in toggle, Oleh Krehel, 2019/07/20