emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ivy-hydra cbcb7ad 034/395: swiper.el (swiper-isearch-fo


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra cbcb7ad 034/395: swiper.el (swiper-isearch-format-function): Refactor
Date: Thu, 25 Feb 2021 08:31:25 -0500 (EST)

branch: externals/ivy-hydra
commit cbcb7ad93dff786fc3734a73f055db9d2e967aa4
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    swiper.el (swiper-isearch-format-function): Refactor
    
    Re #2317
---
 ivy-test.el | 15 +++++++--------
 swiper.el   | 19 ++++++++++++-------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index c15cf2f..fd0b362 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1321,14 +1321,13 @@ a buffer visiting a file."
            (len (length cands)))
       (should (equal cands '(3 9 15 20 25 30 35)))
       (dotimes (index len)
-        (should (string= (substring-no-properties
-                          (swiper--isearch-format
-                           index len
-                           cands
-                           input
-                           (nth index cands)
-                           (current-buffer)))
-                         "line0\nline1\nline line\nline line\nline5"))))))
+        (should (equal (swiper--isearch-format
+                        index len
+                        cands
+                        input
+                        (nth index cands)
+                        (current-buffer))
+                       '("line0" "line1" "line line" "line line" "line5")))))))
 
 (ert-deftest ivy-use-selectable-prompt ()
   (let ((ivy-use-selectable-prompt t)
diff --git a/swiper.el b/swiper.el
index 3e2ecb8..eae89be 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1534,12 +1534,17 @@ When not running `swiper-isearch' already, start it."
   (if (numberp (car-safe cands))
       (if (string= ivy--old-re "^$")
           ""
-        (swiper--isearch-format
-         ivy--index ivy--length ivy--old-cands
-         ivy--old-re
-         (ivy-state-current ivy-last)
-         (ivy-state-buffer ivy-last)))
-    (ivy-format-function-default cands)))
+        (mapconcat
+         #'identity
+         (swiper--isearch-format
+          ivy--index ivy--length ivy--old-cands
+          ivy--old-re
+          (ivy-state-current ivy-last)
+          (ivy-state-buffer ivy-last))
+         "\n"))
+    (funcall
+     (ivy-alist-setting ivy-format-functions-alist t)
+     cands)))
 
 (defun swiper--line-at-point (pt)
   (save-excursion
@@ -1611,7 +1616,7 @@ When not running `swiper-isearch' already, start it."
           (push (swiper--isearch-highlight s) res)
           (cl-incf len))
         (cl-incf i))
-      (mapconcat #'identity (nreverse res) "\n"))))
+      (nreverse res))))
 
 ;;;###autoload
 (defun swiper-isearch (&optional initial-input)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]