bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

prompt with \w incl. long UTF string messes up command line


From: Ryo Furue
Subject: prompt with \w incl. long UTF string messes up command line
Date: Wed, 25 Nov 2015 17:33:42 +0900

Dear bash maintainers,

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin14.5.0
Compiler: clang
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='darwin14.5.0'
-DCONF_MACHTYPE='x86_64-apple-darwin14.5.0' -DCONF_VENDOR='apple'
-DLOCALEDIR='/usr/local/Cellar/bash/4.3.42/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I.
-I./include -I./lib -I./lib/intl
-I/private/tmp/bash20150826-30526-beo5d/bash-4.3/lib/intl
-DSSH_SOURCE_BASHRC
uname output: Darwin furufuru-mac.yes.jamstec.go.jp 15.0.0 Darwin
Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015;
root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin14.5.0

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

Description:
When PS1 includes \w and when \w contains long path including UTF
characters, the cursor position or the command line is messed up.

Repeat-By:
1. Source the attached script:
  $ . bash-prompt-bug.sh

2.1. You'll find the prompt is messed up: shorter than the
   real path name, garbage character at the top.
2.2. If you use the tput commands, which are commented out
   in bash-prompt-bug.sh, the prompt is fine, but the cursor
   position is messed up.

3. After 2.2, try to complete filenames by pressing TAB,
  and sometimes you'll find the cursor position is
  even more badly messed up.

I tested this both on the latest versions of iTerm and Terminal on Mac
OS 10.11.1 .

Thank you for your attention.

Regards,

Ryo

#--- bash-prompt-bug.sh --------
dir='△△△△△△△△△△△△△_△△△△△△△△△△△△△△△△△△△△_△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△△
△△△△△△△△△△△△△△△△△'
#bold='\['$(tput bold)'\]'
#norm='\['$(tput sgr0)'\]'
bold=''
norm=''
PS1="$bold[\w]\$$norm "
mkdir $dir
cd $dir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]