Skip to content

Commit f8f380b

Browse files
committed
bdx: Highlight text matching search query in the minibuffer
* bdx.el (bdx--ivy-display-transformer): Search for the words in the query in each line using regexp and highlight matches.
1 parent a05a1ec commit f8f380b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

bdx.el

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,19 @@ This turns a string of the form \\='function<type<T>>\\=' into
515515
(cl-destructuring-bind
516516
(&key name section path demangled &allow-other-keys) data
517517
(concat
518-
(if (and demangled bdx--demangle-names)
519-
(if bdx--show-templates
520-
demangled
521-
(bdx--untemplatize-string demangled))
522-
name)
518+
(let ((line
519+
(if (and demangled bdx--demangle-names)
520+
(if bdx--show-templates
521+
demangled
522+
(bdx--untemplatize-string demangled))
523+
name)))
524+
(dolist (word (string-split ivy-text))
525+
(when (ignore-errors
526+
(let ((case-fold-search t))
527+
(string-match word line)))
528+
(add-face-text-property (match-beginning 0) (match-end 0)
529+
'ivy-minibuffer-match-face-2 nil line)))
530+
line)
523531
" "
524532
(and bdx--show-sections
525533
(propertize (concat "[" section "]")

0 commit comments

Comments
 (0)