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

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

[nongnu] elpa/helm ce65dd3174 2/4: Merge branch 'master' of github.com:e


From: ELPA Syncer
Subject: [nongnu] elpa/helm ce65dd3174 2/4: Merge branch 'master' of github.com:emacs-helm/helm
Date: Sat, 3 Sep 2022 02:58:52 -0400 (EDT)

branch: elpa/helm
commit ce65dd3174287df6ef18213f7a2e9fd3aa5cde1f
Merge: 10d335dd59 e28c9fcfeb
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Merge branch 'master' of github.com:emacs-helm/helm
---
 helm-utils.el | 58 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 17 deletions(-)

diff --git a/helm-utils.el b/helm-utils.el
index bac0d39720..544cd1fba2 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -87,6 +87,11 @@ Possible value are:
                  (integer :tag "Match after or before (+/-)")
                  (const  :tag "Never match" never)))
 
+(defcustom helm-highlight-only-all-matches nil
+  "If t only highlight if all items matched on the line"
+  :group 'helm-utils
+  :type 'boolean)
+
 (defcustom helm-buffers-to-resize-on-pa nil
   "A list of helm buffers where the helm-window should be reduced on PA.
 Where PA means persistent action."
@@ -872,30 +877,49 @@ Inlined here for compatibility."
                       helm-highlight-matches-around-point-max-lines)
                      (point-at-bol)))))
       (catch 'empty-line
-        (cl-loop with ov
-                 for r in (helm-remove-if-match
-                           "\\`!" (helm-mm-split-pattern
-                                   (if (with-helm-buffer
-                                         ;; Needed for highlighting AG matches.
-                                         (assq 'pcre 
(helm-get-current-source)))
-                                       (helm--translate-pcre-to-elisp 
helm-input)
-                                       helm-input)))
-                 do (save-excursion
-                      (goto-char start-match)
+        (let* ((regex-list (helm-remove-if-match
+                            "\\`!" (helm-mm-split-pattern
+                                    (if (with-helm-buffer
+                                          ;; Needed for highlighting AG 
matches.
+                                          (assq 'pcre 
(helm-get-current-source)))
+                                        (helm--translate-pcre-to-elisp 
helm-input)
+                                      helm-input))))
+               (num-regex (length regex-list)))
+          (save-excursion
+            (goto-char start-match)
+            (while (< (point) end-match)
+              (let* ((start-line (line-beginning-position))
+                     (end-line   (line-end-position))
+                     all-matches)
+                (dolist (r regex-list)
+                  (let ((match-list '()))
+                    (save-excursion
+                      (goto-char start-line)
                       (while (condition-case _err
-                                 (and (not (= start-match end-match))
+                                 (and (not (= start-line end-line))
                                       (if helm-migemo-mode
-                                          (helm-mm-migemo-forward r end-match 
t)
-                                        (re-search-forward r end-match t)))
+                                          (helm-mm-migemo-forward r end-line t)
+                                        (re-search-forward r end-line t)))
                                (invalid-regexp nil))
                         (let ((s (match-beginning 0))
                               (e (match-end 0)))
                           (if (= s e)
                               (throw 'empty-line nil)
-                              (push (setq ov (make-overlay s e))
-                                    helm--match-item-overlays)
-                              (overlay-put ov 'face 'helm-match-item)
-                              (overlay-put ov 'priority 1))))))))
+                            (push (cons s e) match-list)))))
+                    (when match-list
+                      (push match-list all-matches))))
+                (when (and all-matches
+                           (or (not helm-highlight-only-all-matches)
+                               (eql (length all-matches) num-regex)))
+                  (cl-loop for ml in all-matches
+                           do (cl-loop for match in ml
+                                       do (let* ((s (car match))
+                                                 (e (cdr match))
+                                                 (ov (make-overlay s e)))
+                                            (push ov helm--match-item-overlays)
+                                            (overlay-put ov 'face 
'helm-match-item)
+                                            (overlay-put ov 'priority 1))))))
+              (forward-line 1))))))
     (recenter)))
 
 (defun helm--translate-pcre-to-elisp (regexp)



reply via email to

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