zsh-workers
 help / color / mirror / code / Atom feed
* ZLE got wrong prompt line size, resulting redisplay eats lines when called
@ 2022-10-24  7:27 Zang
  2022-10-24  8:20 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Zang @ 2022-10-24  7:27 UTC (permalink / raw)
  To: zsh-workers

Step to reproduce:

1. Run zsh in clean mode
```
zsh -d -f -i
```

2. Set PROMPT, fill line with dash, then carriage return, fill line
with dash again
```
PROMPT="${(pl:${COLUMNS}::-:)}$terminfo[cr]\
${(pl:${COLUMNS}::-:)}$terminfo[cr]\

%# "
```

By using this PROMPT, we filled the first line of the PROMPT with
dashes twice, it takes only a single line.
But it seems that ZLE doesn't understand carriage return, it considers
that the PROMPT takes multiple lines.

3. Bind ctrl-X to redisplay
```
bindkey "^X" redisplay
```

4. By pressing ctrl-x, one will experience the bug, that PROMPT is
eating lines from previous command outputs.


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

* Re: ZLE got wrong prompt line size, resulting redisplay eats lines when called
  2022-10-24  7:27 ZLE got wrong prompt line size, resulting redisplay eats lines when called Zang
@ 2022-10-24  8:20 ` Mikael Magnusson
  2022-10-24  8:38   ` Zang
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2022-10-24  8:20 UTC (permalink / raw)
  To: Zang; +Cc: zsh-workers

On 10/24/22, Zang <zealot0630@gmail.com> wrote:
> Step to reproduce:
>
> 1. Run zsh in clean mode
> ```
> zsh -d -f -i
> ```
>
> 2. Set PROMPT, fill line with dash, then carriage return, fill line
> with dash again
> ```
> PROMPT="${(pl:${COLUMNS}::-:)}$terminfo[cr]\
> ${(pl:${COLUMNS}::-:)}$terminfo[cr]\
>
> %# "
> ```
>
> By using this PROMPT, we filled the first line of the PROMPT with
> dashes twice, it takes only a single line.
> But it seems that ZLE doesn't understand carriage return, it considers
> that the PROMPT takes multiple lines.

If you're printing characters that move the cursor, it is up to you to
tell zsh about it. In this case I suppose you could surround the
entire construct with %{ %}.

-- 
Mikael Magnusson


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

* Re: ZLE got wrong prompt line size, resulting redisplay eats lines when called
  2022-10-24  8:20 ` Mikael Magnusson
@ 2022-10-24  8:38   ` Zang
  0 siblings, 0 replies; 3+ messages in thread
From: Zang @ 2022-10-24  8:38 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-workers

On Mon, Oct 24, 2022 at 4:20 PM Mikael Magnusson <mikachu@gmail.com> wrote:
> If you're printing characters that move the cursor, it is up to you to
> tell zsh about it. In this case I suppose you could surround the
> entire construct with %{ %}.
>

%{ %} works for me. I wish there can be some debug message when any
unrecognized character is encountered while calculating string size.
It is not easy to triangle the root cause of the problem while one
just experiences that some lines are mysteriously gone.

> --
> Mikael Magnusson


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

end of thread, other threads:[~2022-10-24  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  7:27 ZLE got wrong prompt line size, resulting redisplay eats lines when called Zang
2022-10-24  8:20 ` Mikael Magnusson
2022-10-24  8:38   ` Zang

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