GNU bug report logs -
#33230
26.1; Soft-wrap issue in term.el with term-suppress-hard-newline
Previous Next
Reported by: Bruno CHARRON <bruno <at> charron.email>
Date: Thu, 1 Nov 2018 18:31:02 UTC
Severity: normal
Tags: confirmed
Found in versions 26.1, 24.4
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 33230 <at> debbugs.gnu.org (full text, mbox):
On Fri, Nov 2, 2018 at 7:53 AM Noam Postavsky <npostavs <at> gmail.com> 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
This bug report was last modified 3 years and 58 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.