From: Bart Schaefer <schaefer@brasslantern.com>
To: Lewis Butler <lbutler@covisp.net>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Niggling little problem with a theme
Date: Wed, 11 Dec 2019 16:28:46 -0800 [thread overview]
Message-ID: <CAH+w=7YKGG0aJ95KcDV+SgezisiY9qdD00Pk9Da2JTL-7p1HXQ@mail.gmail.com> (raw)
In-Reply-To: <6AC48A70-FD29-4E88-9BD1-B189922E2793@covisp.net>
On Wed, Dec 11, 2019 at 1:37 PM Lewis Butler <lbutler@covisp.net> wrote:
>
> PROMPT=$'%{$fg[magenta]%}$(toon)%{$reset_color%} %{$fg_bold[green]%}%n@%m %{$fg_bold[blue]%}%#%{$reset_color%} '
> RPROMPT=$'%{$fg[blue]%}[%T] %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} ‘
>
> Works fine in nearly all cases, but occasionally when I am trying to edit a command line, the space after the prompt disappears and it makes it quite difficult to edit as the command that appears on the screen is shifted one character off.
You need to look at the "glitch" feature of prompts:
%G Within a %{...%} sequence, include a `glitch': that is, assume
that a single character width will be output. This is useful
when outputting characters that otherwise cannot be correctly
handled by the shell, such as the alternate character set on
some terminals. The characters in question can be included
within a %{...%} sequence together with the appropriate number
of %G sequences to indicate the correct width. An integer
between the `%' and `G' indicates a character width other than
one. Hence %{seq%2G%} outputs seq and assumes it takes up the
width of two standard characters.
So you probably want either %{$(toon)%2G%} in your PROMPT assignment
(indicating that the output of $(toon) takes up exactly two character
widths), or to modify the "toon" function to output the %{...%} along
with the correct number of "glitches" for the emoji it prints. The
latter is likely more easily modifiable.
next prev parent reply other threads:[~2019-12-12 0:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 21:35 Lewis Butler
2019-12-11 22:18 ` Perry Smith
2019-12-12 0:28 ` Bart Schaefer [this message]
2019-12-12 10:30 ` Lewis Butler
2019-12-12 10:44 ` Roman Perepelitsa
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='CAH+w=7YKGG0aJ95KcDV+SgezisiY9qdD00Pk9Da2JTL-7p1HXQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=lbutler@covisp.net \
--cc=zsh-users@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).