;; Otherwise, try to search for the next property.
(unless beg
(setq beg (funcall next-fun old))
- (when beg (goto-char beg)))
+ (when beg
+ (if (or (null bound)
+ (if isearch-forward
+ (< beg bound)
+ (> beg bound)))
+ (goto-char beg)
+ (setq beg nil))))
;; Non-nil `beg' means there are more properties.
(while (and beg (not found))
;; Search for the end of the current property.
;; Get the next text property.
(unless found
(setq beg (funcall next-fun end))
- (when beg (goto-char beg))))
+ (when beg
+ (if (or (null bound)
+ (if isearch-forward
+ (< beg bound)
+ (> beg bound)))
+ (goto-char beg)
+ (setq beg nil)))))
(unless found (goto-char old))
found))
(dolist (pos (append (reverse pairs) nil))
(should (eq (car pos) (isearch-search-string "foo$" nil t)))
(should (equal (match-string 0) "foo"))
- (when (cdr pos) (should (eq (cdr pos) (match-end 0)))))))
+ (when (cdr pos) (should (eq (cdr pos) (match-end 0))))))
+
+ ;; With BOUND arg (bug#78116)
+ (goto-char (point-min))
+ (let ((isearch-forward t)
+ (isearch-regexp nil)
+ (pos (car pairs)))
+ (should (eq (cdr pos) (isearch-search-string "foo" (cdr pos) t)))
+ (should (eq nil (isearch-search-string "foo" (cdr pos) t)))
+ ;; Start on the text property inside boundaries
+ (forward-char -1)
+ (should (eq nil (isearch-search-string "foo" (cdr pos) t))))
+
+ ;; With BOUND arg (bug#78116)
+ (goto-char (point-max))
+ (let ((isearch-forward nil)
+ (isearch-regexp nil)
+ (pos (car (last pairs))))
+ (should (eq (car pos) (isearch-search-string "foo" (car pos) t)))
+ (should (eq nil (isearch-search-string "foo" (car pos) t)))
+ ;; Start on the text property inside boundaries
+ (forward-char 1)
+ (should (eq nil (isearch-search-string "foo" (car pos) t)))))
(ert-deftest isearch--test-search-fun-in-text-property ()
(let* ((pairs '((4 . 7) (11 . 14) (21 . 24)))