Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: "Nellis, Kenneth" 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: 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" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11301 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: cygwin Compiler: gcc Compilation CFLAGS: -DPROGRAM=3D'bash.exe' -DCONF_HOSTTYPE=3D'x86_64' -DCO= NF_OSTYPE=3D'cygwin' -DCONF_MACHTYPE=3D'x86_64-unknown-cygwin' -DCONF_VENDO= R=3D'unknown' -DLOCALEDIR=3D'/usr/share/locale' -DPACKAGE=3D'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/ba= sh-4.3.39-2.x86_64/src/bash-4.3/lib -DWORDEXP_OPTION -ggdb -O2 -pipe -Wimp= licit-function-declaration -fdebug-prefix-map=3D/usr/src/bash-4.3.39-2.x86_= 64/build=3D/usr/src/debug/bash-4.3.39-2 -fdebug-prefix-map=3D/usr/src/bash-= 4.3.39-2.x86_64/src/bash-4.3=3D/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 x8= 6_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 exa= mple, to display the prompt in color. To get proper CTRL-U clearing of input typed at the pr= ompt, 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. Cons= equently, for prompts containing ansi escape sequences, CTRL-U doesn't clear the line properly. Repeat-By: The following example demonstrates the problem. $ prompt=3D"$(tput setaf 2)test>$(tput sgr0) " $ read -ep "$prompt" answer test> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Note that all the x's are not cleared.