diff options
| author | Stefan Monnier | 2025-03-29 16:40:19 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2025-03-29 17:49:49 -0400 |
| commit | 57da44fa702782e19cd9d60ea63ec2fd9ca48521 (patch) | |
| tree | 7182b458505348be363d9c0093a98a8b5043fb79 /test/src | |
| parent | 7c82cc8b975175aebbad1c43ec1cd98b3232f482 (diff) | |
| download | emacs-57da44fa702782e19cd9d60ea63ec2fd9ca48521.tar.gz emacs-57da44fa702782e19cd9d60ea63ec2fd9ca48521.zip | |
src/insdel.c (adjust_markers_for_replace): Fix insertion case
test/src/editfns-tests.el (editfns-tests--insert-via-replace): New test
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 3da9d4e8acd..2553ad3ec2c 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -357,6 +357,20 @@ | |||
| 357 | (should (= m7a (+ (point-min) 7))))) | 357 | (should (= m7a (+ (point-min) 7))))) |
| 358 | (widen))))) | 358 | (widen))))) |
| 359 | 359 | ||
| 360 | (ert-deftest editfns-tests--insert-via-replace () | ||
| 361 | (with-temp-buffer | ||
| 362 | (insert "bar") | ||
| 363 | (goto-char (point-min)) | ||
| 364 | ;; Check that markers insertion type is respected when an insertion | ||
| 365 | ;; happens via a "replace" operation. | ||
| 366 | (let ((m1 (copy-marker (point) nil)) | ||
| 367 | (m2 (copy-marker (point) t))) | ||
| 368 | (looking-at "\\(\\)") | ||
| 369 | (replace-match "foo") | ||
| 370 | (should (equal "foobar" (buffer-string))) | ||
| 371 | (should (= (point-min) m1)) | ||
| 372 | (should (= (+ (point-min) 3) m2))))) | ||
| 373 | |||
| 360 | (ert-deftest delete-region-undo-markers-1 () | 374 | (ert-deftest delete-region-undo-markers-1 () |
| 361 | "Make sure we don't end up with freed markers reachable from Lisp." | 375 | "Make sure we don't end up with freed markers reachable from Lisp." |
| 362 | ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40 | 376 | ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40 |