Subject: bug#48716: 28.0.50; Spurious output from term-emulate-terminal when in line-mode

From: Sean Whitton <[email-masked]>
Date: Thu, 02 Jun 2022 19:46:14 -0700

Hello,

On Fri 28 May 2021 at 04:00PM +01, Massimiliano Mirra wrote:

> Spurious output is occasionally produced when running a command
> with `make-term', and the command performs cursor movements and
> partial screen clears.
>
> [...]
>
> The culprit appears to be following lines from `term-emulate-terminal'
> in term.el; commenting them out fixes this problem:
>
>    (when (and (> (point-max) (process-mark proc))
>       (term-in-line-mode))
>      (narrow-to-region (point-min) (process-mark proc)))

The code assumes anything after the process mark is prospective input,
which is very often going to be wrong when the command moves the cursor
-- even if the command just emits \r.  One way to fix this might be to
add text properties to actual output, thereby distinguishing it from
something the user has typed.

-- 
Sean Whitton