           (re (ivy--regex ivy-text)))
       (save-excursion
         (beginning-of-line)
-        (while (and (re-search-forward re end t)
-                    (not (eobp)))
+        (while (re-search-forward re end t)
           (let ((ov (make-overlay (1- (match-end 0)) (match-end 0)))
                 (md (match-data t)))
             (overlay-put

      (save-excursion
        (goto-char (if backward (point-max) (point-min)))
        (while (and (funcall (if backward #'re-search-backward #'re-search-forward) re nil t)
                    (not (if backward (bobp) (eobp))))
          (when (swiper-match-usable-p)
            (let ((pos (if (or backward swiper-goto-start-of-match)
                           (match-beginning 0)


(ivy-configure 'swiper-query-replace
  :update-fn #'swiper--query-replace-updatefn)
(put 'swiper-query-replace 'no-counsel-M-x t)

(defvar inhibit-message)

