Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: [readline] Multibyte invisible chars cause weird prompt length calculation issue Date: Wed, 27 Nov 2019 11:11:07 -0500 Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: <3dd641953467a3299265e479026fc40a7bb697d4.camel@mail.ru> <68c76159-3cf3-b12f-9145-f0578d5415a3@case.edu> <20191127161107.GR851@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1574871073 4593 209.51.188.17 (27 Nov 2019 16:11:13 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org Mail-Followup-To: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: <68c76159-3cf3-b12f-9145-f0578d5415a3@case.edu> User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20191127161107.GR851@eeg.ccf.org> X-Mailman-Original-References: <3dd641953467a3299265e479026fc40a7bb697d4.camel@mail.ru> <68c76159-3cf3-b12f-9145-f0578d5415a3@case.edu> Xref: csiph.com gnu.bash.bug:15660 On Wed, Nov 27, 2019 at 11:02:49AM -0500, Chet Ramey wrote: > On 11/25/19 10:05 AM, Алексей Шилин wrote: > > I'm using the following PS1 prompt (Debian's default for normal users): > > > > \[\e]0;\u@\h: > > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\ > > ]:\[\033[01;34m\]\w\[\033[00m\]\$ > > > > ...where the first block '\[\e]0;\u@\h: \w\a\]' is for setting xterm's > > title, and the rest is Debian's "fancy" shell prompt. > > Is there a literal newline in the prompt string? And is it in the middle > of the non-printing character block? No, at least not in Debian's configuration files. It's most likely an artifact of their mail user agent. Debian's /etc/skel/.bashrc contains these lines: if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi The leading \[\e]0... part appears to be a local addition.