[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash doesn't display user-typed characters; can interfere with COPY/PAST
From: |
L A Walsh |
Subject: |
bash doesn't display user-typed characters; can interfere with COPY/PASTE |
Date: |
Mon, 07 Dec 2020 17:02:35 -0800 |
User-agent: |
Thunderbird |
If I type in (<TAB> + <ENTER> are keypresses)
if [[ '<TAB>' == $'\t' ]]; then echo ok; else echo notok; fi <ENTER>
bash displays:
if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi
ok
if I now copy the 'if' line and paste it
if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi
notok
if I take the same line from an editor like gvim, it works.
If the test line is in a file, and I use 'cat file' and copy/past the
resulting line, it works.
It is only when bash is displaying the line that it doesn't work.
The problem is that bash isn't displaying a 'tab' character where
one was typed. With many (most?) terminal windows these days, especially
Unicode-enabled ones, the terminal has to read what is on the screen to
be able to read the binary code of whatever is displayed on the screen,
Otherwise, it wouldn't be able to read typed unicode.
Can this be fixed -- maybe with an option in 'shopt', for those who might
be using a non-expanding terminal, but anyone using an xterm/linux
compatible
terminal should get the expansions from their terminal.
Where this can be even more annoying is if your terminal's response to a tab
is different than that used on old-hardware terminals.
Thanks,
-l
- bash doesn't display user-typed characters; can interfere with COPY/PASTE,
L A Walsh <=