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

Re: Possible bug to RPROMPT



On Aug 5, 12:54am, Bart Schaefer wrote:
} Subject: Re: Possible bug to RPROMPT
}
} PS1="%-40<<$PS1"
} 
} and then you always have 40 characters in which to type.  It belatedly
} occurs to me that you can *already* get this with
} 
} setopt promptsubst
} PS1='%$((COLUMNS-40))<<'"$PS1"

I should have pointed out that these aren't fully equivalent unless they
appear at the "left end" of the prompt, because of course the first one
truncates more of the prompt the farther to the right it appears, whereas
the second always truncates the same.

However, there's some odd behavior when the computed result is actually
zero or less; it's then treated as %<< (i.e., as if with no numeric
argument), and no truncation occurs at all.  That's very unintuitive,
but it stems from being able to use %<< as an end marker for a preceding
truncation.

Merely documenting this doesn't seem sufficient.  On the other hand, a
similar odd thing happens with positive truncation because of implicit
line wrapping; try %90>=> followed by 100+ characters on an 80-column
terminal to see what I mean.



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