From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bruno CHARRON Newsgroups: gmane.emacs.bugs Subject: bug#33230: 26.1; Soft-wrap issue in term.el with term-suppress-hard-newline Date: Fri, 2 Nov 2018 09:50:57 +0900 Message-ID: References: <87h8h0if4u.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1541119806 22299 195.159.176.226 (2 Nov 2018 00:50:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Nov 2018 00:50:06 +0000 (UTC) Cc: 33230@debbugs.gnu.org To: npostavs@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 02 01:50:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gINez-0005gr-Mq for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Nov 2018 01:50:01 +0100 Original-Received: from localhost ([::1]:48465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gINh5-0001f5-US for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Nov 2018 20:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gINh0-0001ex-0a for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 20:52:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gINgw-00025j-Nz for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 20:52:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gINgw-00025d-KD for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 20:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gINgw-0003A9-EJ for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 20:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bruno CHARRON Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Nov 2018 00:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33230 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33230-submit@debbugs.gnu.org id=B33230.154111989112120 (code B ref 33230); Fri, 02 Nov 2018 00:52:02 +0000 Original-Received: (at 33230) by debbugs.gnu.org; 2 Nov 2018 00:51:31 +0000 Original-Received: from localhost ([127.0.0.1]:59083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gINgQ-00039Q-MX for submit@debbugs.gnu.org; Thu, 01 Nov 2018 20:51:30 -0400 Original-Received: from mx1.polytechnique.org ([129.104.30.34]:35961) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gINgO-00039H-Sl for 33230@debbugs.gnu.org; Thu, 01 Nov 2018 20:51:29 -0400 Original-Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id A26AF56123C for <33230@debbugs.gnu.org>; Fri, 2 Nov 2018 01:51:25 +0100 (CET) Original-Received: by mail-wr1-f53.google.com with SMTP id d10-v6so293942wrs.5 for <33230@debbugs.gnu.org>; Thu, 01 Nov 2018 17:51:25 -0700 (PDT) X-Gm-Message-State: AGRZ1gJviq+XxZXgtejkwCsPfwHRDXxYBJkzTn8/1sc3/2aagKSPbLLD 8R0IPHCE5AFg6CcTxqhQJu0e3ykBlTlTTsXJj/k= X-Google-Smtp-Source: AJdET5cIbIqn7XHgW6nHFjam7k15xnOGl+IxHi8lHQwv5dM28D/cvwN/zsyy5s8ogrY8dSjAr9q7l6bzZkHNB8M3qjM= X-Received: by 2002:a5d:6309:: with SMTP id i9-v6mr8046070wru.163.1541119885119; Thu, 01 Nov 2018 17:51:25 -0700 (PDT) In-Reply-To: <87h8h0if4u.fsf@gmail.com> X-Gmail-Original-Message-ID: X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Fri Nov 2 01:51:25 2018 +0100 (CET)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151934 Archived-At: On Fri, Nov 2, 2018 at 7:53 AM Noam Postavsky wrote: > Can you explain exactly what you're typing in? I don't understand what > 'x^M^[[K' means here. Is specific to zsh? Is it specific to your > prompt settings? Sorry the line break ate the space, the shell response is 'x ^M^[[K' and the issue is with the space. Basically I am typing 'x' repeatedly in the command line until it reaches the right screen edge. Setting term-log-buffer as t, I can see what the shell is sending to emacs in the Messages buffer. When I type 'x' in the middle of the screen, the shell responds 'x' to print an 'x' at the current cursor position. When I type 'x' on the last column, the shell responds 'x ^M^[[K', which I could understand with this explanation [1]. It seems to be the standard way to ask the terminal to wrap the line under uncertainty on its behavior. First it asks to insert 'x' on the last column, then some terminals will wrap then but just in case it asks to insert an additional ' ' to force wrapping then erases the new line (carriage return '^M' then erase to end of line '^[[K', see [2]). If term.el processes 'x' first then ' ', it will wrap when processing the ' ' but when term-suppress-hard-newline is t, it processes both at the same time and doesn't wrap due to the reason explained in the original post. When the command line has some attributes, e.g. bold red, the shell sends '^[[1m^[[31mx^[[m^[[39m ^M^[[K', which means turn on bold ('^[[1m') red ('^[[31m'), insert 'x', reset attributes ('^[[m') and set default color ('^[[39m'), insert space, then '^M^[[K' as before. Interestingly, in that case, term.el will first process the 'x' then the ' ' because there are control commands in between, and there is no issue (it wraps). See a gif of that behavior in [3]. The behavior is the same with 'bash --norc', although it only returns 'x ^M', no '^[[K'. It does not depend on my prompt and also happens with 'zsh -f'. [1] https://stackoverflow.com/a/31360700 [2] http://man7.org/linux/man-pages/man4/console_codes.4.html [3] https://i.imgur.com/1dIQ8c6.gif