*Below are generated automatically by **'/usr/bin/bashbug' due to the absence of 'rmail**’** command.*
---------------------------------------------------------------------------- ------- *From:* Michael(lwl2...@gmail.com) *To:* bug-bash@gnu.org *Subject: *The Unexpected Behavior When Using ANSI Escape Code. *Configuration Information [Automatically generated, do not change]:* Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS uname output: Linux arch80g 5.16.13-arch1-1 #1 SMP PREEMPT Tue, 08 Mar 2022 20:07:36 +0000 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.1 Patch Level: 16 Release Status: release *Description:* Background: A normal Bash user for a while. When ``PS1’’ environment variable contains the ANSI escape codes, Bash will behavior unexpectedly when Copy&Paste the content from clipboard using Ctrl+V. This unexpected behaviour could be easily reproduced in a few steps. Reproduceable steps are: 1) $ PS1='---Test \\ \e[0m ---\\$ ' [Press <ENTER> Key] 2) [Paste '123456789_123456789_' with <Ctrl+V>] 3) [Press <Right Arrow> Key] 4) [Everything Is Fine] 5) [Paste '123456789_123456789_123456789_' with <Ctrl+V>] 6) [Press <Right Arrow> Key] 7) ---Test \ ---$ 1234123456789_123456789_123456789 [Result in Extra Charavters: The Leading '1234'] 8) [Paste '123456789_123456789_'] 9) [Press <Right Arrow> Key] 10) [Everything Is Fine] According to my limited tests, this behavior (i.e., Step7) could exist on serveral platforms on which the BASH_VERSION is 5.x.x. However, this behavior cannot be found on the same platforms while 4.x.x/3.x.x version of Bash is invoked. When the steps mentioned above being applied to other counterparts which currently being as active development as Bash, Step7 would not happen for them. Hence, it is a reasonable guess that this might be bug for 5.x.x version of Bash. If not, that would be my misuse of Bash, and would appreciate for taking time reading my report. *Repeat-By:* No currently. *Fix:* Would be glad to provide a fix if I'm capable of. ---------------------------------------------------------------------------- ------- 2022/03/20 Michael Lee lwl2...@gmail.com