Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 1/1] prompt: Fix an off-by-one in the overf check in countpromt.



This is what I was worried about, hence why I included the cover letter.

I just tried setting ZLE_RPROMPT_INDENT=0 in my .zshrc and my terminal
freaked out, it had no idea what to do with the cursor after I reached the
bottom corner. Length or wraps of my LPROMPT didn't matter much since I
have a multi-line config. The LPROMPT will not touch that character
position, but the RPROMPT does. However, this would most likely indeed
freak out on single-line LPROMPTS, although I could not come up with a
config that'd do it.

I don't think doing this based on ZLE_RPROMT_INDENT is the way to go,
libvte based terminals require the number of TCUPs to match the number of
lines the final prompt will have when drawn. I am open for fixing this
patch, if we can reach an agreement on what the proper handling should be.
I am sadly not clever enough about shells to come up with something on my
own here. I am available in the IRC channel for discussion if that would
help the decision making, since I can test configs quite quickly that way.


On Tue, Jan 16, 2018 at 4:28 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> On Mon, Jan 15, 2018 at 2:35 AM,  <warepire.ml@xxxxxxxxx> wrote:
> > From: Warepire <Warepire@xxxxxxxxxxxxxxxxxxxxxxxx>
> >
> > This triggers overf when the prompt is exactly as wide as the
> > term, causes countprompt to count a 2-line prompt as 3 lines.
> > Which transmits an errorneus TCUP to the PTY. In some terminals
> > this causes the last line of the previous command to be erased.
>
> I see this has already been pushed to the zsh git, but I'm not sure
> it's entirely correct.
>
> This may cause problems on some terminals where auto-margin causes an
> additional linefeed when the rightmost (or in some cases only the
> bottom rightmost) character position is written.  I would be willing
> to bet that the original code was intended to account for this, and
> other code has changed around it.
>
> The correct thing may be to make this conditional upon
> ZLE_RPROMPT_INDENT, or introduce a similar setting to override the
> terminfo assertions of auto-wrap/auto-margin so that the user can
> assert whether the additional TCUP is needed.
>


Messages sorted by: Reverse Date, Date, Thread, Author