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

Re: Stripping superfluous spaces in command input



>Is anyone planning to add an option that will strip trailing and unquoted
>extra spaces from zle input?  If not, I'd appreciate a hint how best to
>go about it.  I think I would like to add the stripping to the zleread()
>function, but I'm not sure what functions are available to help me find
>the next token on the line so that I only eliminate superfluous spaces.

There's the lexer, but the interface is not well suited to this
purpose.  It's not terribly well suited to most of zle_tricky.c,
either.  I'm considering making large changes in that area (including
maybe having ZLE actually ask the parser what the command and arguments
are, rather than using its quite badly flawed guesswork).  At that
point such an option should become easier to implement.

Or there's an alternative way: use the existing functions to generate a
textual representation of the parsed line.  This isn't really usable
for this purpose at present, as it will reorder bits of the command
line and so on.  Actually someone should really go through that code in
detail sometime, and make sure its representation really is accurate,
particularly taking metafication issues into consideration.

-zefram




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