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

Re: Bug report

On Dec 14,  8:43pm, Peter Stephenson wrote:
} Seems to work: I've sanity checked for negative values and the worst I
} can see happening with large numbers is the prompt doesn't appear.

Something isn't quit right here.  In the copy-paste below, pay attention
to what happens to the left prompt; the placement of the right prompt is
correct, though vagaries of email may have muddled the line width or

torch% setopt promptsubst
torch% PS1=987654321_ RPS1='$ZLE_RPROMPT_INDENT'

Cursor is immediately to the left of the "_" as expected.

987654321_ZLE_RPROMPT_INDENT=2                                                1
987654321ZLE_RPROMPT_INDENT=3                                                2
98765432ZLE_RPROMPT_INDENT=4                                                3
9876543ZLE_RPROMPT_INDENT=5                                                4
987654ZLE_RPROMPT_INDENT=6                                                5
98765ZLE_RPROMPT_INDENT=7                                                6
987654321_                                                              7

Cursor is presently on the "5" digit in PS1.

9876ZLE_RPROMPT_INDENT=0                                                7
987654321_ echo oops                                                           0

Cursor is now one full space to the right of the "_".  So whatever moves
the cursor "back" to PS1 after drawing RPS1 still calculates as if the
right-indent is always 1.  If I set ZLE_RPROMPT_INDENT to a value larger
than the number of characters in $PS1 but smaller than $COLUMNS, the
cursor actually moves up to the line above, which I can't really show
with cut-and-paste.

It appears that if you want to make this offset different from 1, you
are going to have to change countprompt() to include the offset in the
width of the prompt rather than just fiddle with math in the output code.

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