Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11301

Ctrl-U doesn't clear read -ep prompt input properly

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From "Nellis, Kenneth" <Kenneth.Nellis@xerox.com>
Newsgroups gnu.bash.bug
Subject Ctrl-U doesn't clear read -ep prompt input properly
Date Fri, 7 Aug 2015 13:36:50 +0000
Lines 47
Approved bug-bash@gnu.org
Message-ID <mailman.7934.1438956061.904.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1438956062 5185 208.118.235.17 (7 Aug 2015 14:01:02 GMT)
X-Complaints-To action@cs.stanford.edu
To "bug-bash@gnu.org" <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
Thread-Topic Ctrl-U doesn't clear read -ep prompt input properly
Thread-Index AdDRFd18t91bb7jLQx62YAkulZgEpA==
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [13.41.230.87]
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 13.24.230.20
X-Mailman-Approved-At Fri, 07 Aug 2015 10:01:00 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11301

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='x86_64-unknown-cygwin' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS   -I.  -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3 -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3/include -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3/lib  -DWORDEXP_OPTION -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/bash-4.3.39-2.x86_64/build=/usr/src/debug/bash-4.3.39-2 -fdebug-prefix-map=/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3=/usr/src/debug/bash-4.3.39-2
uname output: CYGWIN_NT-6.1 COR900GFY5 2.2.0(0.289/5/3) 2015-08-03 12:51 x86_64 Cygwin
Machine Type: x86_64-unknown-cygwin

Bash Version: 4.3
Patch Level: 39
Release Status: release

Description:
Pressing CTRL-U after entering data in response to a read -ep prompt should work as does the PS1 bash prompt.
Consider a custom PS1 bash prompt containing ansi escape sequences, for example, to display
the prompt in color. To get proper CTRL-U clearing of input typed at the prompt, bash
recognizes special \ [ and \ ] delimiters in the prompt string. Here is my PS1, for example:
\ [ ESC [ 3 2 m \ ] $ SP \ [ ESC ( B ESC [ m \ ] LF
which displays a "$ " prompt in green.
Without \ [ and \ ] in the prompt, CTRL-U doesn't clear the line properly, so it's a necessary feature.

read -ep prompt, however, does not support the \ [ and \ ] delimiters. Consequently, for prompts containing
ansi escape sequences, CTRL-U doesn't clear the line properly.

Repeat-By:
The following example demonstrates the problem.
$ prompt="$(tput setaf 2)test>$(tput sgr0) "
$ read -ep "$prompt" answer
test> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<CTRL-U>

Note that all the x's are not cleared.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Ctrl-U doesn't clear read -ep prompt input properly "Nellis, Kenneth" <Kenneth.Nellis@xerox.com> - 2015-08-07 13:36 +0000

csiph-web