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

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

[elpa] master 8c1a2fa 107/399: Allow all re-builders to use ivy-highligh


From: Oleh Krehel
Subject: [elpa] master 8c1a2fa 107/399: Allow all re-builders to use ivy-highlight-grep-commands
Date: Sat, 20 Jul 2019 14:56:58 -0400 (EDT)

branch: master
commit 8c1a2faffd4d0356cc23dccf57ccf33d55a87fce
Author: Troy Hinckley <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Allow all re-builders to use ivy-highlight-grep-commands
    
    Fixes #1983
---
 ivy.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index ab933f9..1d413b1 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3504,15 +3504,11 @@ Note: The usual last two arguments are flipped for 
convenience.")
   "Highlight STR, using the default method."
   (unless ivy--old-re
     (setq ivy--old-re (funcall ivy--regex-function ivy-text)))
-  (let ((start
-         (if (and (memq (ivy-state-caller ivy-last) 
ivy-highlight-grep-commands)
-                  (string-match "\\`[^:]+:[^:]+:" str))
-             (match-end 0)
-           0))
-        (regexps
+  (let ((regexps
          (if (listp ivy--old-re)
              (mapcar #'car (cl-remove-if-not #'cdr ivy--old-re))
-           (list ivy--old-re))))
+           (list ivy--old-re)))
+        start)
     (dolist (re regexps)
       (ignore-errors
         (while (and (string-match re str start)
@@ -3537,7 +3533,14 @@ Note: The usual last two arguments are flipped for 
convenience.")
   "Format line STR for use in minibuffer."
   (let* ((str (ivy-cleanup-string (copy-sequence str)))
          (str (if (eq ivy-display-style 'fancy)
-                  (funcall ivy--highlight-function str)
+                  (if (memq (ivy-state-caller ivy-last)
+                            ivy-highlight-grep-commands)
+                      (let* ((start (if (string-match "\\`[^:]+:[^:]+:" str)
+                                        (match-end 0) 0))
+                             (file (substring str 0 start))
+                             (match (substring str start)))
+                        (concat file (funcall ivy--highlight-function match)))
+                    (funcall ivy--highlight-function str))
                 str))
          (olen (length str))
          (annot (plist-get completion-extra-properties :annotation-function)))



reply via email to

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