Subject: 27.0.50; term.el regression handling zsh prompt - extra "%"

From: Noam Postavsky <[email-masked]>
Date: Sun, 11 Mar 2018 20:42:24 -0400

This is a regression in master (emacs-26 is ok), as reported in [1]:

    when I open term or ansi-term there is always a % character at the
    end of every command i execute in term.

Stated in terms of tests/lisp/term.el, the following fails:

    (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 ?_)))))

Patch to follow.

[1]: https://emacs.stackexchange.com/questions/39207/emacs-27-0-50-term-el-doesnt-play-well-with-zsh