From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60244: 27.1; term-line-mode works poorly with git progress rewriting Date: Sat, 24 Dec 2022 17:40:40 +0200 Message-ID: <8335946c93.fsf@gnu.org> References: <26518-1671655038-943352@sneakemail.com> <26909-1671659920-451215@sneakemail.com> <83cz8c9b7t.fsf@gnu.org> <87ili07sly.fsf@miha-pc> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-hoffman@snkmail.com, 60244@debbugs.gnu.org To: Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 24 16:41:12 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 1p96e7-0000ab-Vy for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 16:41:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p96e0-0005JO-Gy; Sat, 24 Dec 2022 10:41:04 -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 1p96dy-0005GJ-ST for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:41:02 -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 1p96dy-0001g7-KH for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p96dy-0007KE-3g for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 10:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Dec 2022 15:41:02 +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.167189645228132 (code B ref 60244); Sat, 24 Dec 2022 15:41:02 +0000 Original-Received: (at 60244) by debbugs.gnu.org; 24 Dec 2022 15:40:52 +0000 Original-Received: from localhost ([127.0.0.1]:46948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p96dl-0007JW-4d for submit@debbugs.gnu.org; Sat, 24 Dec 2022 10:40:52 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p96dj-0007JC-Sd for 60244@debbugs.gnu.org; Sat, 24 Dec 2022 10:40:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p96dd-0001Xm-Py; Sat, 24 Dec 2022 10:40:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6jCUXUIeu0GJDEOWn7Kpe+tfsSef033MCTHAyCNr52k=; b=R+Jbh41jU6nM 6IvLpurcznbfuEINGQ3KdpO220WofKDaKOuDmG5e5QrA+KbxEaPcHIoAd6XZwh+Z8X/cYs9W67KUH Ocw+lUkmg6bb1hV8WbPnf5Qu5SEr8lbbZ5cqv8dE0ZdlEyIRaACegUIrx4Y/JL1OKpLQBRT+nUqnv cv3FnAcMSxhorm9/Kxv4V70m1KGTQ5qwVGytSARsxC0PPrTY2PbKb3oHXR4gtzNKeOErFEl6NG1iQ 0oa2xi/c09U1o+d5pe5//SgwSlskmgDRbiPCNWQw/3/GWkiJnsAyNHkCFvkMunanLRDbwJ3qfkdIu GHrqUqWiBEJBuU+cA1ZSPA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p96dd-0003IZ-AG; Sat, 24 Dec 2022 10:40:41 -0500 In-Reply-To: <87ili07sly.fsf@miha-pc> 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:251806 Archived-At: > From: > Cc: 60244@debbugs.gnu.org > Date: Sat, 24 Dec 2022 16:02:01 +0100 > > 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: > > - Introduce a new marker to separate user input from process output. > > - Use text properties to distinguish user input from process output. > This is what comint.el does, it marks process output with 'field' = > 'output'. > > Hope this helps. Unfortunately I can't promise to be able work on any > solution at the moment. Thanks for the analysis. This is AFAIU an old issue, so fixing it is not urgent. I hope Someone(TM) will implement one of your solutions at some point.