From 4c33ad4a244db59bfe128aa54380904efdc775ba Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 11 Mar 2018 20:47:12 -0400 Subject: Fix line-wrapping for term.el (Bug#30775) * lisp/term.el (term-emulate-terminal): Leave line-wrapping state if point was moved after we entered it. * test/lisp/term-tests.el (term-line-wrapping-then-motion): New test. --- test/lisp/term-tests.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/lisp/term-tests.el') diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index 234dfa1f0d5..8aaa61a210b 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -124,6 +124,18 @@ line6\r 40 12 (list "\eAnSiTc /f" "oo/\n") 'default-directory) "/foo/")))) +(ert-deftest term-line-wrapping-then-motion () + "Make sure we reset the line-wrapping state after moving cursor. +A real-life example is the default zsh prompt which writes spaces +to the end of line (triggering line-wrapping state), and then +sends a carriage return followed by another space to overwrite +the first character of the line." + (let* ((width 10) + (strs (list "x" (make-string (1- width) ?_) + "\r_"))) + (should (equal (term-test-screen-from-input width 12 strs) + (make-string width ?_))))) + (provide 'term-tests) ;;; term-tests.el ends here -- cgit v1.2.1