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

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

[elpa] externals/consult 30210f53ad 1/2: consult--find-highlights: Ignor


From: ELPA Syncer
Subject: [elpa] externals/consult 30210f53ad 1/2: consult--find-highlights: Ignore completions-first-difference
Date: Thu, 29 Sep 2022 19:57:24 -0400 (EDT)

branch: externals/consult
commit 30210f53ad8ce14fb3e337cfe006e9926c4978a4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult--find-highlights: Ignore completions-first-difference
---
 consult.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/consult.el b/consult.el
index 9d82776901..a3838505ba 100644
--- a/consult.el
+++ b/consult.el
@@ -572,12 +572,16 @@ Turn ARG into a list, and for each element either:
 (defun consult--find-highlights (str start)
   "Find highlighted regions (face property non-nil) in STR from position 
START."
   (let (highlights
-        (len (length str))
-        (beg start) end)
-    (while (and beg (setq beg (text-property-not-all beg len 'face nil str)))
-      (setq end (text-property-any beg len 'face nil str))
-      (push (cons (- beg start) (- (or end len) start)) highlights)
-      (setq beg end))
+        (end (length str))
+        (beg start))
+    (while (< beg end)
+      (let ((next (next-single-property-change beg 'face str end))
+            (val (get-text-property beg 'face str)))
+        (when (and val
+                   (not (eq val 'completions-first-difference))
+                   (not (and (listp val) (memq 'completions-first-difference 
val))))
+          (push (cons (- beg start) (- next start)) highlights))
+        (setq beg next)))
     (nreverse highlights)))
 
 (defun consult--highlight-regexps (regexps ignore-case str)



reply via email to

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