diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2023-06-08 21:53:02 +0100 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2023-06-08 23:50:37 +0200 |
| commit | 1d37abaa9e9da89c6e9461804595e338b5ef3585 (patch) | |
| tree | 9815db12a939ecd8ba256c55831da8e09500b362 | |
| parent | 55446ec083bfec20733230e4c4365ae9cf43d3ae (diff) | |
Improve case handling for :match
| -rw-r--r-- | evil-commands.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/evil-commands.el b/evil-commands.el index ab4ad2c..50b3c4f 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -4229,16 +4229,21 @@ Unlike vim, multiple highlights can be set at once, so there is no need for (cl-destructuring-bind (_ _ fs fe ss se) (match-data) (let* ((face (unless (= fs fe) (substring args fs fe))) (search-string (unless (= ss se) (substring args ss se))) - (patterns (evil-delimited-arguments (or search-string face ""))) - (pattern (if (and (car patterns) evil-ex-search-vim-style-regexp) - (evil-transform-vim-style-regexp (car patterns)) - (car patterns)))) + (raw-patterns (evil-delimited-arguments (or search-string face ""))) + (raw-pattern (or (car raw-patterns) "")) + (case-fold-search ;; ignore case if non-nil + (eq (evil-ex-regex-case raw-pattern evil-ex-search-case) 'insensitive)) + (search-upper-case nil) ;; bypass isearch-no-upper-case-p + (pattern-no-case (evil-ex-regex-without-case raw-pattern)) + (pattern (if evil-ex-search-vim-style-regexp + (evil-transform-vim-style-regexp pattern-no-case) + pattern-no-case))) (cond ((or (not face) (string= "none" face)) (if bang (hi-lock-unface-buffer t) (call-interactively #'hi-lock-unface-buffer))) - ((/= 1 (length patterns)) + ((/= 1 (length raw-patterns)) (user-error "Invalid pattern argument supplied")) ((not search-string) (hi-lock-face-buffer pattern (hi-lock-read-face-name))) |
