Subject: Re: bug#48399: 27.2; term-mode: After splitting window, newlines are inserted

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 13 Jul 2022 00:21:14 +0200

Andreas Schwab <[email-masked]> writes:

> You can reproduce that by just printing "\e[K" to the terminal, which is
> handled by term-erase-in-line.

Thanks.  I can confirm that the newline is added by
term-erase-in-line -- the following makes the problem go away:

diff --git a/lisp/term.el b/lisp/term.el
index a28d8c5d76..3a9d41ffc1 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -3979,7 +3979,7 @@ term-erase-in-line
       ;; extra space when wrapped is false.
       (when wrapped
 	(insert ? ))
-      (insert ?\n)
+      ;;(insert ?\n)
       (put-text-property saved-point (point) 'font-lock-face 'default)
       (goto-char saved-point))))

But is obviously not the right thing...  But I guess it could be the
right thing if we only skip the newline insertion if we're at the
prompt?  (I don't know how to determine that, though.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no