Update buffer's chars-modified tick when inserting from gap
* src/insdel.c (insert_from_gap): Update buffer's chars-modified tick. (Bug#56393) * test/src/buffer-tests.el (test-buffer-chars-modified-ticks): New test.
This commit is contained in:
parent
a29a3ad55d
commit
51f8e86374
2 changed files with 21 additions and 0 deletions
|
@ -1123,6 +1123,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail)
|
|||
invalidate_buffer_caches (current_buffer, GPT, GPT);
|
||||
record_insert (GPT, nchars);
|
||||
modiff_incr (&MODIFF);
|
||||
CHARS_MODIFF = MODIFF;
|
||||
|
||||
insert_from_gap_1 (nchars, nbytes, text_at_gap_tail);
|
||||
|
||||
|
|
|
@ -1535,4 +1535,24 @@ with parameters from the *Messages* buffer modification."
|
|||
(restore-buffer-modified-p 'autosaved)
|
||||
(should (eq (buffer-modified-p) 'autosaved)))))
|
||||
|
||||
(ert-deftest test-buffer-chars-modified-ticks ()
|
||||
"Test `buffer-chars-modified-tick'."
|
||||
(setq temporary-file-directory (file-truename temporary-file-directory))
|
||||
(let ((text "foobar")
|
||||
f1 f2)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(setq f1 (make-temp-file "buf-modiff-tests")
|
||||
f2 (make-temp-file "buf-modiff-tests"))
|
||||
(with-current-buffer (find-file f1)
|
||||
(should (= (buffer-chars-modified-tick) 1))
|
||||
(should (= (buffer-chars-modified-tick) (buffer-modified-tick)))
|
||||
(write-region text nil f2 nil 'silent)
|
||||
(insert-file-contents f2)
|
||||
(should (= (buffer-chars-modified-tick) (buffer-modified-tick)))
|
||||
(should (> (buffer-chars-modified-tick) 1))))
|
||||
(if f1 (delete-file f1))
|
||||
(if f2 (delete-file f2))
|
||||
)))
|
||||
|
||||
;;; buffer-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue