From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60244: 27.1; term-line-mode works poorly with git progress rewriting Date: Sat, 24 Dec 2022 16:02:01 +0100 Message-ID: <87ili07sly.fsf@miha-pc> References: <26518-1671655038-943352@sneakemail.com> <26909-1671659920-451215@sneakemail.com> <83cz8c9b7t.fsf@gnu.org> Reply-To: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23615"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60244@debbugs.gnu.org To: Eli Zaretskii , Michael Hoffman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 24 16:02:30 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p962f-0005tC-EX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 16:02:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p962J-0000lK-2K; Sat, 24 Dec 2022 10:02:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p962E-0000l9-SV for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:02:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p962E-0001qK-JM for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p962E-00065v-1q for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Dec 2022 15:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60244 X-GNU-PR-Package: emacs Original-Received: via spool by 60244-submit@debbugs.gnu.org id=B60244.167189410223397 (code B ref 60244); Sat, 24 Dec 2022 15:02:01 +0000 Original-Received: (at 60244) by debbugs.gnu.org; 24 Dec 2022 15:01:42 +0000 Original-Received: from localhost ([127.0.0.1]:46928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p961t-00065J-HF for submit@debbugs.gnu.org; Sat, 24 Dec 2022 10:01:41 -0500 Original-Received: from kamnitnik.top ([209.250.245.214]:46028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p961r-000657-BR for 60244@debbugs.gnu.org; Sat, 24 Dec 2022 10:01:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1671894098; bh=+gX/xT29XTdF6br94JnYmsxOvccTaY9ceciSvoGBbIE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=iEbp9/U3K9qWsFvzel0wDATX1GUHt1buTblI4wdLRkRGfLemeggYVoxbTZdvfjVne sWs2vA7C/qoSpyuuiOhVIrooP1Np0z/2U4sIDrfkjAXAD5/0PjL9OdL/IKvspcSIjH 1LqPyulY5HFhgJ4/QiAxghRWxZf/q+13PGjmt2DOes9tNPCA3aEPGtqxkaHf3qDy2m wxfDabCH4ze6RpXi0a/1ZjlP/yl8NrifPB6lmdTL9Z8bRiCJPem4k1w5jdT8PfoR65 i6V/0e2/ysX2v5p1NLBgV8Got8Dwn9DJ3hQ76l58cma/18dbcQtdRdMCGQ00M5BKDu KqBLJPT+nWW1A== In-Reply-To: <83cz8c9b7t.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251804 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> Date: Wed, 21 Dec 2022 21:58:40 +0000 >> From: "Michael Hoffman" >>=20 >> This line of bash is a better minimum example for this that doesn't requ= ire going over the network: >>=20 >> printf "line %d" 0; for i in {1..500}; do tput cr; printf "line %d" "$i"= ; done > > Funny thing is, "M-x term" does produce the expected results, and I > cannot find what makes "M-x ansi-term" behave differently, as it's > supposed to be almist the same as "M-x term". > > Miha, could you perhaps look into this issue? A more reliable example would be this bash line: printf 'foo \015'; sleep 2; printf 'bar' In char mode, it writes foo and overwrites it with bar, which is expected. But in line mode, it pushes foo after the process mark. I could reproduce the issue in both M-x term and M-x ansi-term. The issue happens due this code in function term-emulate-terminal: ;; If the buffer is in line mode, and there is a partial ;; input line, save the line (by narrowing to leave it ;; outside the restriction ) until we're done with output. (when (and (> (point-max) (process-mark proc)) (term-in-line-mode)) (narrow-to-region (point-min) (process-mark proc))) The idea is to let the user edit his partial input during a long-running command. But term.el assumes that, in line mode, all text after process mark is user input, it doesn't distinguish between actual user input and process output that happens to be behind process mark. This is also the reason why a lot of full-screen TUI programs such as "htop" don't work correctly in line mode even if they do in char mode. Two possible ideas to solve this: =2D Introduce a new marker to separate user input from process output. =2D Use text properties to distinguish user input from process output. This is what comint.el does, it marks process output with 'field' =3D 'output'. Hope this helps. Unfortunately I can't promise to be able work on any solution at the moment. Best regards. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmOnFGkTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP4XyD/sHECWkomlmiIC9ppRbpqfRlmaoPHfl WSuX58D+YvY8loJcS0mdnPpms0G1p7p/4LvZPQXbEf2gh/N7yxZMrihuSCGSaM/n 5vmQfiP5SWjsGlLCGsQrusfR8rmP4Siauuiz1gMh/aQApW04ve/g2OYr0TgmCLGY 0SuTCjwty94W3BisBrYb3HIHtAdWjp42V5U3rAOBAfsmXGhZhPACMgiitR+6wmR2 ZSxLgXovaIMbmTe3lgB6ZWDkeBaIGZ6IbAqf5886Rnr833qEe8chKWoK0eI79+x6 ryf+wSawolwMZjquqMWtSDhZz0o5VWq9gL/RHSWd4VwMYyBccKqCkqGe0fioXOW7 i3A2nd3kJ5IT+jKD5VqFUhfXOpRX4NdEHUxo5hVCwCH/urmwdXpzfuvFFwJi7Unj uYw/Qz/ZeVXTAV72gSI+9sxrutCUgJxKD+zvARIHvG/JfA+pAQ9LPW8SKCoAv4sL xyzosC/TIuJtSnHkJPB+hWVFHtAW2uGnXLY6Z4+aaDM+aoalM+U6n2LHeRboXDVp grUxlihpSlqWe3nNC0agUSNiQnxf9IP8Ze7VgWOnTk8pFuvYAQZlMUnA+k+jAeEu rONPuyq1AIFxQJXpxlu208v/N7Z/smHIR/2Eq+lvpQ2lhoi5pPNSi99V8l2AmIrx MRLB2iO4x1ge8Q== =2lpg -----END PGP SIGNATURE----- --=-=-=--