From: Nathan Sidwell <nathan@acm.org>
To: dana <dana@dana.is>, roman.perepelitsa@gmail.com
Cc: zsh-workers@zsh.org
Subject: Re: unicode in prompt breaks command search
Date: Fri, 17 Jan 2020 07:05:00 -0500 [thread overview]
Message-ID: <dfe17c2d-4fc7-4048-074c-7ce6cd3e005e@acm.org> (raw)
In-Reply-To: <6D242ADC-BAEC-450D-B7BC-974988C38066@dana.is>
On 1/16/20 8:25 PM, dana wrote:
> On 16 Jan 2020, at 15:43, Nathan Sidwell <nathan@acm.org> wrote:
>> For reasons, I put a multibyte unicode char in $PROMPT, this ends up messing
>> with zsh's idea of the current column, as it doesn't understand the display
>> width of $PROMPT.
>
> You need to tell it what it is with the %{/%} and/or %G escape sequences. For
> example, all of these are roughly equivalent and let zsh know that アイウエオ
> takes up ten columns:
>
> PROMPT='%10{アイウエオ%}'
> PROMPT='%{アイウエオ%10G%}'
> PROMPT='%{%2Gア%2Gイ%2Gウ%2Gエ%2Gオ%}'
>
> %{...%} without a leading digit or embedded %G is zero-width (useful for
> invisible escape sequences).
>
> http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects
>
> (I don't think the behaviour of these sequences has changed since 5.2, but you
> can check your zshmisc(1) to be sure)
On 1/17/20 3:23 AM, Roman Perepelitsa wrote:
> Zsh can figure out how many columns Unicode characters take provided
> that you configure locale correctly. The most common reason why Zsh
> might think that every byte is one character is because the encoding
> in the current locale is not UTF-8.
thanks for the pointers!
nathan
--
Nathan Sidwell
prev parent reply other threads:[~2020-01-17 12:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 21:43 Nathan Sidwell
2020-01-17 1:25 ` dana
2020-01-17 8:23 ` Roman Perepelitsa
2020-01-17 12:05 ` Nathan Sidwell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfe17c2d-4fc7-4048-074c-7ce6cd3e005e@acm.org \
--to=nathan@acm.org \
--cc=dana@dana.is \
--cc=roman.perepelitsa@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).