[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash doesn't display user-typed characters; can interfere with COPY/

From: Greg Wooledge
Subject: Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE
Date: Tue, 8 Dec 2020 09:28:20 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Tue, Dec 08, 2020 at 09:07:33AM -0500, Chet Ramey wrote:
> On 12/7/20 8:02 PM, L A Walsh wrote:
> > The problem is that bash isn't displaying a 'tab' character where
> > one was typed.
> It's readline and redisplay. Readline expands tabs to spaces using an
> internal tab stop of 8. This allows it to be sure of the physical cursor
> location, especially when you're doing things like wrapping lines, and
> insulates it from varying terminal behavior.

In addition to what I said earlier, there is a distinction between
things that you *typed* in bash/readline, and then tried to copy with
the mouse, and text that was generated by a command (e.g. cat yourscript),
which you then tried to copy.

And if you're actually typing in a text editor, rather than in bash, then
obviously the behavior of the editor is what matters.

The end result is that it's basically impossible to preserve the original
whitespace of your source material across a terminal copy/paste operation.
So don't count on that.

There's a *reason* bash introduced the $'\t' quoting.  Use it, rather
than using literal tab characters.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]