aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/buffer-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-08-16 15:40:43 +0200
committerLars Ingebrigtsen2021-08-16 15:40:43 +0200
commit5d7b1d5fc75752a986ed19d3fd333167ddc29d4e (patch)
tree2958f419b095ee6e5f7eada504dfcaf40e5d10a8 /test/src/buffer-tests.el
parenta3b31302dd1b7c1ffd3486b35de06c957785b919 (diff)
downloademacs-5d7b1d5fc75752a986ed19d3fd333167ddc29d4e.tar.gz
emacs-5d7b1d5fc75752a986ed19d3fd333167ddc29d4e.zip
Make overlays-in treat zero-length overlays at point-max consistently
* doc/lispref/display.texi (Finding Overlays): Adjust documentation. * src/buffer.c (overlays_in): Treat the end of the buffer and the end of the narrowed-to buffer the same (bug#19422). (Foverlays_in): Adjust doc string.
Diffstat (limited to 'test/src/buffer-tests.el')
-rw-r--r--test/src/buffer-tests.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 11f842e8fe0..118311c4d26 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -754,7 +754,7 @@ with parameters from the *Messages* buffer modification."
754 (should-length 2 (overlays-in 1 (point-max))) 754 (should-length 2 (overlays-in 1 (point-max)))
755 (should-length 1 (overlays-in (point-max) (point-max))) 755 (should-length 1 (overlays-in (point-max) (point-max)))
756 (narrow-to-region 1 50) 756 (narrow-to-region 1 50)
757 (should-length 0 (overlays-in 1 (point-max))) 757 (should-length 1 (overlays-in 1 (point-max)))
758 (should-length 1 (overlays-in (point-max) (point-max)))))) 758 (should-length 1 (overlays-in (point-max) (point-max))))))
759 759
760 760
@@ -1399,4 +1399,25 @@ with parameters from the *Messages* buffer modification."
1399 (should (memq long-overlay (overlays-in 3 3))) 1399 (should (memq long-overlay (overlays-in 3 3)))
1400 (should (memq zero-overlay (overlays-in 3 3)))))) 1400 (should (memq zero-overlay (overlays-in 3 3))))))
1401 1401
1402(ert-deftest test-remove-overlays ()
1403 (with-temp-buffer
1404 (insert "foo")
1405 (make-overlay (point) (point))
1406 (should (= (length (overlays-in (point-min) (point-max))) 1))
1407 (remove-overlays)
1408 (should (= (length (overlays-in (point-min) (point-max))) 0)))
1409
1410 (with-temp-buffer
1411 (insert "foo")
1412 (goto-char 2)
1413 (make-overlay (point) (point))
1414 ;; We only count zero-length overlays at the end of the buffer.
1415 (should (= (length (overlays-in 1 2)) 0))
1416 (narrow-to-region 1 2)
1417 ;; We've now narrowed, so the zero-length overlay is at the end of
1418 ;; the (accessible part of the) buffer.
1419 (should (= (length (overlays-in 1 2)) 1))
1420 (remove-overlays)
1421 (should (= (length (overlays-in (point-min) (point-max))) 0))))
1422
1402;;; buffer-tests.el ends here 1423;;; buffer-tests.el ends here