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

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

[elpa] externals/ivy-hydra d539306 307/395: Revert "ivy.el (ivy-display-


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra d539306 307/395: Revert "ivy.el (ivy-display-style): Remove"
Date: Thu, 25 Feb 2021 08:32:26 -0500 (EST)

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

    Revert "ivy.el (ivy-display-style): Remove"
    
    This reverts commit a4a22e0755a9a7155e5bc8fd88ac0db03889d135.
    
    Fixes #2570
---
 doc/ivy.org  |  7 +++++++
 doc/ivy.texi |  8 ++++++++
 ivy.el       | 29 +++++++++++++++++++++--------
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/doc/ivy.org b/doc/ivy.org
index 6149670..20a5e7e 100644
--- a/doc/ivy.org
+++ b/doc/ivy.org
@@ -809,6 +809,13 @@ installed.
      The =format=-style switches this variable uses are described
      in the =format= documentation.
 
+- User Option =ivy-display-style= ::
+     Specifies highlighting candidates in the minibuffer.
+
+     The default setting is ='fancy= in Emacs versions 24.4 or newer.
+
+     Set =ivy-display-style= to =nil= for a plain minibuffer.
+
 - User Option =ivy-on-del-error-function= ::
      Specifies what to do when ~DEL~ (=ivy-backward-delete-char=) fails.
 
diff --git a/doc/ivy.texi b/doc/ivy.texi
index 3b0ed19..24a1f89 100644
--- a/doc/ivy.texi
+++ b/doc/ivy.texi
@@ -1082,6 +1082,14 @@ The @code{format}-style switches this variable uses are 
described
 in the @code{format} documentation.
 @end defopt
 
+@defopt ivy-display-style
+Specifies highlighting candidates in the minibuffer.
+
+The default setting is @code{'fancy} in Emacs versions 24.4 or newer.
+
+Set @code{ivy-display-style} to @code{nil} for a plain minibuffer.
+@end defopt
+
 @defopt ivy-on-del-error-function
 Specifies what to do when @kbd{DEL} (@code{ivy-backward-delete-char}) fails.
 
diff --git a/ivy.el b/ivy.el
index aee0d36..1bc6d9e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -83,6 +83,17 @@ Set this to \"(%d/%d) \" to display both the index and the 
count."
   "When non-nil, wrap around after the first and the last candidate."
   :type 'boolean)
 
+(defcustom ivy-display-style 'fancy
+  "The style for formatting the minibuffer.
+
+By default, the matched strings are copied as is.
+
+The fancy display style highlights matching parts of the regexp,
+a behavior similar to `swiper'."
+  :type '(choice
+          (const :tag "Plain" nil)
+          (const :tag "Fancy" fancy)))
+
 (defcustom ivy-on-del-error-function #'abort-recursive-edit
   "Function to call when deletion fails during completion.
 The usual reason for `ivy-backward-delete-char' to fail is when
@@ -3971,14 +3982,16 @@ in this case."
 (defun ivy--format-minibuffer-line (str)
   "Format line STR for use in minibuffer."
   (let* ((str (ivy-cleanup-string (copy-sequence str)))
-         (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 (if (eq ivy-display-style 'fancy)
+                  (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)))
     (add-text-properties



reply via email to

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