summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPip Cet <pipcet@protonmail.com>2026-05-24 11:51:38 +0000
committerPip Cet <pipcet@protonmail.com>2026-05-24 11:51:38 +0000
commit7f8ac8bf6f04045a676543862098c47bbf732f9e (patch)
tree5e5466ef8b18a8aea56e66664382f1e27d21d38e /test
parent94dbab2fe45fdcdcefc3a19ecf6c2063eecc1df2 (diff)
Avoid crash in self-insert-command for peculiar arguments
* src/cmds.c (internal_self_insert): Don't call auto-fill-function after inserting zero newlines. * test/src/cmds-tests.el (self-insert-zero-newlines): New.
Diffstat (limited to 'test')
-rw-r--r--test/src/cmds-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/cmds-tests.el b/test/src/cmds-tests.el
index a02c36868ca..8c0e4706e3c 100644
--- a/test/src/cmds-tests.el
+++ b/test/src/cmds-tests.el
@@ -40,5 +40,13 @@
(let ((shortage (forward-line (+ 2 most-positive-fixnum))))
(should (= shortage (1+ most-positive-fixnum))))))
+(ert-deftest self-insert-zero-newlines ()
+ "Test `self-insert-command' with arguments which used to cause a crash."
+ (with-temp-buffer
+ (let* ((pt nil)
+ (auto-fill-function (lambda () (setq pt (point)))))
+ (self-insert-command 0 10)
+ (should-not (equal pt 0)))))
+
(provide 'cmds-tests)
;;; cmds-tests.el ends here