> I'm not sure why the result would be different between > dired-do-find-regexp-and-replace and project-query-regexp-replace, though. project-query-regexp-replace doesn't use xref--query-replace-1. Actually, the reported problem is not specific to xref. Performing replacements on a rectangular region doesn't allow searching outside the region on recursive edit too. So here is a general fix that covers all cases: