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

Re: readability (was: Re: prompt color pbg ,pfg,pbg_bold,pfg_bold in colors function?)



On Sat, Aug 19, 2006 at 11:39:25AM -0700, Bart Schaefer:
> } perhaps i was mistaken to think that every escape code needs
> } needs these %{ %} around it.
> } so i thought it really had to be done  with any new one.
> 
> Think of it in terms of cursor motion.  You need %{ when the cursor
> stops moving and %} when it starts again, and in between you can do
> anything you like (including sending the cursor off to some other
> part of the screen, as long as you bring it back to the original spot
> again before closing the braces).  You also need %{ and %} only as
> they affect the same screen line where the prompt finally finishes,
> because zle only cares about horizontal position, not vertical.

This was very helpful to me as I did not consider color to
be a cursor motion but i know that ansi escapes include
those.
I do remember seeing the effect of bad cursor movement in bash 1
when programming my PS1-prompt :) and when i ever forget to use
%{ %} at zsh PS1 once more. :)

> } The biggest problem in zsh functions is readability
> 
> You mean in cryptic sytax for parameter expansions and format strings.

The lack of white space is something i really suffer in
specific zsh features often and the abundance of
tooooooooooo long lines.
That makes reading so exhausting and I know it's not only me!

Functions to having done many of these nice builtin features like splitting, joining, uppercasing e.g.
would have had a much better effect on readability.  Instead
it's done using modifiers. Variables nestings have to be
blamed for much of the rest.

What would I lose if I was not to go the dirty nesting way
but assign to the same variable once again?
When would I really suffer from efficiency lack? Ever?
My only other help are continuation lines.

                Matthias



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