Skip to content

Commit

Permalink
Handling regex characters
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantvarma committed Jul 24, 2015
1 parent 7e0e7c4 commit 2c18a46
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions ido-vertical-mode.el
Expand Up @@ -132,24 +132,25 @@ so we can restore it when turning `ido-vertical-mode' off")
(setq additional-items-indicator "\n")
(setq comps (append comps (make-list (- (1+ ido-max-prospects) lencomps) "")))))

(when ido-use-faces
;; Make a copy of [ido-matches], otherwise the selected string
;; could contain text properties which could lead to weird
;; artifacts, e.g. buffer-file-name having text properties.
(when (eq comps ido-matches)
(setq comps (copy-sequence ido-matches)))

(dotimes (i ido-max-prospects)
(setf (nth i comps) (substring (if (listp (nth i comps))
(car (nth i comps))
(nth i comps))
0))
(when (string-match name (nth i comps))
(ignore-errors
(add-face-text-property (match-beginning 0)
(match-end 0)
'ido-vertical-match-face
nil (nth i comps))))))
(if (not ido-incomplete-regexp)
(when ido-use-faces
;; Make a copy of [ido-matches], otherwise the selected string
;; could contain text properties which could lead to weird
;; artifacts, e.g. buffer-file-name having text properties.
(when (eq comps ido-matches)
(setq comps (copy-sequence ido-matches)))

(dotimes (i ido-max-prospects)
(setf (nth i comps) (substring (if (listp (nth i comps))
(car (nth i comps))
(nth i comps))
0))
(when (string-match (if ido-enable-regexp name (regexp-quote name)) (nth i comps))
(ignore-errors
(add-face-text-property (match-beginning 0)
(match-end 0)
'ido-vertical-match-face
nil (nth i comps)))))))

(if (and ind ido-use-faces)
(put-text-property 0 1 'face 'ido-indicator ind))
Expand Down

0 comments on commit 2c18a46

Please sign in to comment.