diff options
| author | Stefan Monnier | 2022-11-01 21:38:55 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2022-11-01 21:39:12 -0400 |
| commit | 8a5678906fa1b899c4d111e5ee4334b278f50d48 (patch) | |
| tree | 37a1266d9a21cdccb9dcf220e680c23f2576c7f2 /test/src/buffer-tests.el | |
| parent | 835295381bdee3d517c7ee243a22640c78783a9f (diff) | |
| download | emacs-8a5678906fa1b899c4d111e5ee4334b278f50d48.tar.gz emacs-8a5678906fa1b899c4d111e5ee4334b278f50d48.zip | |
src/buffer.c: Fix interaction between overlays & indirect buffers (bug#58928)
* src/buffer.c (adjust_overlays_for_insert)
(adjust_overlays_for_delete): Repeat for all buffers sharing the same text.
* src/itree.c (itree_insert_gap, itree_delete_gap): Allow an empty tree.
* test/src/buffer-tests.el (buffer-tests--overlays-indirect-bug58928):
New test.
Diffstat (limited to 'test/src/buffer-tests.el')
| -rw-r--r-- | test/src/buffer-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index e0207325241..b96a8dcacd2 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el | |||
| @@ -275,6 +275,27 @@ with parameters from the *Messages* buffer modification." | |||
| 275 | (with-temp-buffer | 275 | (with-temp-buffer |
| 276 | (should (eq (buffer-base-buffer (current-buffer)) nil)))) | 276 | (should (eq (buffer-base-buffer (current-buffer)) nil)))) |
| 277 | 277 | ||
| 278 | (ert-deftest buffer-tests--overlays-indirect-bug58928 () | ||
| 279 | (with-temp-buffer | ||
| 280 | (insert "hello world") | ||
| 281 | (let* ((base (current-buffer)) | ||
| 282 | (ol1 (make-overlay (+ 2 (point-min)) (+ 8 (point-min)))) | ||
| 283 | (ib (make-indirect-buffer | ||
| 284 | base (generate-new-buffer-name "bug58928"))) | ||
| 285 | (ol2 (with-current-buffer ib | ||
| 286 | (make-overlay (+ 2 (point-min)) (+ 8 (point-min)))))) | ||
| 287 | (should (equal (overlay-start ol1) (overlay-start ol2))) | ||
| 288 | (should (equal (overlay-end ol1) (overlay-end ol2))) | ||
| 289 | (goto-char (+ 3 (point-min))) | ||
| 290 | (insert "a") (delete-char 2) | ||
| 291 | (should (equal (overlay-start ol1) (overlay-start ol2))) | ||
| 292 | (should (equal (overlay-end ol1) (overlay-end ol2))) | ||
| 293 | (with-current-buffer ib | ||
| 294 | (goto-char (+ 4 (point-min))) | ||
| 295 | (insert "a") (delete-char 2)) | ||
| 296 | (should (equal (overlay-start ol1) (overlay-start ol2))) | ||
| 297 | (should (equal (overlay-end ol1) (overlay-end ol2)))))) | ||
| 298 | |||
| 278 | (ert-deftest overlay-evaporation-after-killed-buffer () | 299 | (ert-deftest overlay-evaporation-after-killed-buffer () |
| 279 | (let* ((ols (with-temp-buffer | 300 | (let* ((ols (with-temp-buffer |
| 280 | (insert "toto") | 301 | (insert "toto") |