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

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

[elpa] externals/ivy 031d4d0 1/2: Preserve idx text property in marked c


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy 031d4d0 1/2: Preserve idx text property in marked candidates
Date: Tue, 27 Jul 2021 15:11:01 -0400 (EDT)

branch: externals/ivy
commit 031d4d051da1d8fd20f0f46e8df66c426bf3174c
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Preserve idx text property in marked candidates
    
    Both internal and external code expects the idx property to be on
    the first character of the candidate.  Since ivy--mark actually
    makes the mark a part of the candidate, it should also preserve any
    text properties at the start of the candidate.
    
    * ivy.el (ivy--mark): Copy any text properties from the start of the
    candidate to the mark prefix.  Consistently use destructive
    operations on ivy-marked-candidates.
---
 ivy.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 908f399..659ba3e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -5238,11 +5238,16 @@ EVENT gives the mouse position."
         (delete cand ivy-marked-candidates)))
 
 (defun ivy--mark (cand)
-  (let ((marked-cand (concat ivy-mark-prefix cand)))
+  (let ((marked-cand (copy-sequence (concat ivy-mark-prefix cand))))
+    ;; Primarily for preserving `idx'.  FIXME: the mark
+    ;; prefix shouldn't become part of the candidate!
+    (add-text-properties 0 (length ivy-mark-prefix)
+                         (text-properties-at 0 cand)
+                         marked-cand)
     (setcar (member cand ivy--all-candidates)
             (setcar (member cand ivy--old-cands) marked-cand))
     (setq ivy-marked-candidates
-          (append ivy-marked-candidates (list marked-cand)))))
+          (nconc ivy-marked-candidates (list marked-cand)))))
 
 (defun ivy-mark ()
   "Mark the selected candidate and move to the next one.



reply via email to

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