Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11926
| Path | csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Linda Walsh <bash@tlinx.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: prompt with \w incl. long UTF string messes up command line |
| Date | Thu, 26 Nov 2015 03:28:01 -0800 |
| Lines | 65 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.743.1448537302.31583.bug-bash@gnu.org> (permalink) |
| References | <CAGKoo-yvVMR3Oy81ENDwZa4w5Smr6wx9euB_Dkr3ELtGOdF_5g@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | usenet.stanford.edu 1448537303 32147 208.118.235.17 (26 Nov 2015 11:28:23 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | Ryo Furue <ryofurue@gmail.com> |
| To | bug-bash <bug-bash@gnu.org> |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Thunderbird |
| In-Reply-To | <CAGKoo-yvVMR3Oy81ENDwZa4w5Smr6wx9euB_Dkr3ELtGOdF_5g@mail.gmail.com> |
| X-MIME-Autoconverted | from 8bit to quoted-printable by Ishtar.hs.tlinx.org id tAQBS0IX008392 |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] |
| X-Received-From | 173.164.175.65 |
| 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:11926 |
Show key headers only | View raw
Your prompt might be too long.
Your 'dir' string is awfully long...
echo "$dir"|wc -c
270
---
I tried a shorter version on linux:
sdir='△△△△△△△△△△△△△_ >'
pre='Ishtar:/tmp/' ## prefix of my dir
Ishtar:/tmp/△△△△△△△△△△△△△>
012345678901234567890123456
-bash: 012345678901234567890123456: command not found
Ishtar:/tmp/△△△△△△△△△△△△△> echo ${#pre}+${#sdir}=$[${#pre}+${#sdir}]
12+13=25
My cursor started in col 27 with 26 chars preceding it.
As you can see above adding the length in chars
of the prefix and the UTF chars together, I get 25, + the '>'
at the end=26. and together :
Ishtar:/tmp/△△△△△△△△△△△△△> echo "$pre$sdir>"|wc -c
53
are only 53 bytes long.
Ryo Furue wrote:
> 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.
----
Bash doesn't honor tabs as set on your terminal
at all. It always expands them to '8' spaces and it's concept
of where it is vs. using actual tab chars which would have
output looking like what you typed.
>
> I tested this both on the latest versions of iTerm and Terminal on Mac
> OS 10.11.1 .
----
I tested this on bash 4.3.39. Maybe the MAC doesn't
handle the expansions right?
Back to gnu.bash.bug | Previous | Next | Find similar
Re: prompt with \w incl. long UTF string messes up command line Linda Walsh <bash@tlinx.org> - 2015-11-26 03:28 -0800
csiph-web