Spurious output is occasionally produced when running a command with `make-term', and the command performs cursor movements and partial screen clears. - Reproduction #1 shows what happens when using `yarn' to install packages in a NodeJS project. (For ease and reliability of reproduction, a recording made with script(1) is run instead of the actual command.) Run with: emacs -Q -l repro-1.el Preview: https://asciinema.org/a/4mMv1aIrMmizwxr01AaEXMQqe - Reproduction #2 shows a minimal (provided) Python program that creates a progress bar. Run with: emacs -Q -l repro-2.el Preview: https://asciinema.org/a/K6XCPbgkuqk6op4KQyiX9L5n7 The problem only happens in `term-line-mode' (the default). `term-char-mode' works fine. It is affected by the rate of output: changing "scriptreplay" in repro-1.el to "scriptreplay -d 5" (5x speed) still produces different, though still wrong, output. 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))) In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4) of 2021-05-16 built on 956e3d7386ff Repository revision: 78575c53fc8c78de1494822f9f6680e2a21308d6 Repository branch: pgtk-nativecomp Windowing system distributor 'System Description: Arch Linux Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games --with-sound=alsa --with-modules --with-x-toolkit=gtk3 --with-cairo --with-xwidgets --with-native-compilation --with-pgtk --without-compress-install --without-gconf --without-gsettings --without-m17n-flt --enable-autodepend --enable-link-time-optimization CC=/usr/bin/clang 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -flto' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now 'CPP=/usr/bin/clang -E'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM XWIDGETS GTK3 ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LC_MESSAGES: en_US.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/pgtk-win pgtk-win term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal dbusbind inotify dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit pgtk lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 69245 8432) (symbols 48 6922 0) (strings 32 20554 2262) (string-bytes 1 684028) (vectors 16 13527) (vector-slots 8 293613 14217) (floats 8 22 39) (intervals 56 240 0) (buffers 992 10)) -- Massimiliano Mirra massimilianomirra.com