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

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

[nongnu] elpa/anzu 5718f08dc6 066/288: Fix case fold issue


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 5718f08dc6 066/288: Fix case fold issue
Date: Thu, 6 Jan 2022 03:58:40 -0500 (EST)

branch: elpa/anzu
commit 5718f08dc65fe43783ac5042b7466ea5cfabad13
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Fix case fold issue
    
    Match count is invalid if user input has UPPER character
---
 anzu.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/anzu.el b/anzu.el
index 642d0fd53d..c0ad3a3e0a 100644
--- a/anzu.el
+++ b/anzu.el
@@ -125,6 +125,10 @@
 (defsubst anzu--construct-position-info (count overflow positions)
   (list :count count :overflow overflow :positions positions))
 
+(defsubst anzu--case-fold-search (input)
+  (let ((case-fold-search nil))
+    (not (string-match-p "[A-Z]" input))))
+
 (defun anzu--search-all-position (str)
   (unless anzu--last-command
     (setq anzu--last-command last-command))
@@ -141,7 +145,8 @@
             (finish nil)
             (search-func (if (and anzu-use-migemo migemo-isearch-enable-p)
                              'migemo-forward
-                           're-search-forward)))
+                           're-search-forward))
+            (case-fold-search (anzu--case-fold-search str)))
         (while (and (not finish) (funcall search-func str nil t))
           (push (cons (match-beginning 0) (match-end 0)) positions)
           (incf count)
@@ -264,10 +269,6 @@
     (overlay-put ov 'face 'anzu-replace-highlight)
     (overlay-put ov 'anzu-replace t)))
 
-(defsubst anzu--case-fold-search (input)
-  (let ((case-fold-search nil))
-    (not (string-match-p "[A-Z]" input))))
-
 (defun anzu--count-matched (buf str replace-beg replace-end use-regexp 
overlay-limit)
   (when (not use-regexp)
     (setq str (regexp-quote str)))



reply via email to

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