anzu
anzu copied to clipboard
anzu-query-replace: counter can be wrong when using suggested query/replace criteria
As reported in #93.
With case-fold-search
set to t
in a buffer containing:
Gee AB ab AB ab AB ab.
Do, in sequence,
-
anzu-query-replace e RET RET
-- the counter is (1/2) -- quit and go back at the bol (C-a
), then -
anzu-query-replace ab RET RET
-- the counter is (1/6) --C-a
, then -
anzu-query-replace RET
(accepting the proposed replacementab →
); the counter wrongly shows (1/2).
This last bug has proved rather hard to reproduce consistently. If I run all the other tests, including those with case-fold-search set to nil, then set case-fold-search to t again and run this one, at point 3 the counter becomes (1/6) instead of (1/2). If you can't reproduce point 3, do another replacement of "e", quit and do an additional one using the suggested replacement, I get (1/6) instead of (1/2) sometimes. The heart of the matter is that sometimes Anzu appears to use the previous replacement's count when performing another one using the suggested completion.
Additionally, with case-fold-search
set to nil
in the same buffer:
-
anzu-query-replace
"ab" with "cd": offers to replace each "ab" with "cd" , counts correctly to 3 matches; HOWEVER a secondanzu-query-replace
and accepting the default criteria (ab → cd) results in an incorrect count of 6 matches. -
anzu-query-replace
"AB" with "CD": offers to replace each "AB" with "CD", counts correctly to 3 matches; again repeating the same query replace with default arguments results in an incorrect count of 6 matches.