zsh-workers
 help / color / mirror / code / Atom feed
* Bug in RPROMPT alighnment
@ 2022-10-04  7:24 Dan Neal
  2022-10-04  8:32 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Neal @ 2022-10-04  7:24 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

When a hyperlink is included in the RPROMPT, zsh mistakenly thinks the
RPROMPT is longer than it actually is.  This results in the RPROMPT not
being aligned all the way to the right but floats further to the middle.

A minimal .zshrc demonstrating the bug:
```
RPROMPT=$(eval "echo '\e]8;;http://example.com\aThis is a link\e]8;;\a'")
```

The hyperlink specification is here:
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

Please feel free to email me or cc me with any followup.

[-- Attachment #2: Type: text/html, Size: 956 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in RPROMPT alighnment
  2022-10-04  7:24 Bug in RPROMPT alighnment Dan Neal
@ 2022-10-04  8:32 ` Mikael Magnusson
  2022-10-04 19:40   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2022-10-04  8:32 UTC (permalink / raw)
  To: Dan Neal; +Cc: zsh-workers

On 10/4/22, Dan Neal <dan.r.neal@gmail.com> wrote:
> When a hyperlink is included in the RPROMPT, zsh mistakenly thinks the
> RPROMPT is longer than it actually is.  This results in the RPROMPT not
> being aligned all the way to the right but floats further to the middle.
>
> A minimal .zshrc demonstrating the bug:
> ```
> RPROMPT=$(eval "echo '\e]8;;http://example.com\aThis is a link\e]8;;\a'")
> ```
>
> The hyperlink specification is here:
> https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
>
> Please feel free to email me or cc me with any followup.

You need to use %{ and %} around non-printable escape sequences in your prompt.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in RPROMPT alighnment
  2022-10-04  8:32 ` Mikael Magnusson
@ 2022-10-04 19:40   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2022-10-04 19:40 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Dan Neal, zsh-workers

On Tue, Oct 4, 2022 at 1:33 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> On 10/4/22, Dan Neal <dan.r.neal@gmail.com> wrote:
> > ```
> > RPROMPT=$(eval "echo '\e]8;;http://example.com\aThis is a link\e]8;;\a'")
> > ```
>
> You need to use %{ and %} around non-printable escape sequences in your prompt.

In this case he needs %{ %} around everything but "This is a link"
because the entire URL is "non-printable":

RPROMPT=$(eval "echo '%{\e]8;;http://example.com\a%}This is a
link%{\e]8;;\a%}'")


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-04 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04  7:24 Bug in RPROMPT alighnment Dan Neal
2022-10-04  8:32 ` Mikael Magnusson
2022-10-04 19:40   ` Bart Schaefer

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).