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

Re: Revised dohistexpand()



Peter wrote:
>Still, now I've found out what all this code does, maybe I can work
>around it some other way.  I'm hoping, eventually, to modify the
>history code so that only the lines actually typed are stored, with
>the word separation in a list of numbers

I like this idea.  Much of the expansion/completion code could benefit
from having the parser point out word beginnings to it.  This would be
a great aid to consistency in complex quoting (e.g. "a b" "`a b`" "`'a
b'`" etc.).  It would similarly help to have nesting indicated in this
way, to help with command/process substitution.

I note that you confine history expansion to the current word.  This
has the rather nice effect that typing "!!^V abc<magic-space>" won't
expand the initial !!, which is helpful for those of us using
magic-space.  However, it has some problems associated with it.  Does
extended completion work after (in a separate word from) a history
reference, bearing in mind that the history reference could expand to
several words?

On magic-space: it shouldn't expand history when the cursor is in a
history reference (e.g. !{a<magic-space>).  At the moment
doexpandhist() removes the word; it should feep and leave the word
unchanged.  The same applies to expand-history, which also calls
doexpandhist().  I also think an error should be flagged when
attempting to expand an invalid history reference, rather than removing
it (this would accurately reflect how zsh treats the bad history
reference in a completed line).

Magic-space also ought to do no history expansion immediately after a
backslash.  This is already fixed in the hzoli releases.

Finally, I think this new patch reintroduces an old bug.  (I don't have
hzoli10.2 to check it, but I'm fairly certain.)  Prior to the patch the
code contains a statement that resets the vi beginning-of-insertion
pointer to the beginning of the line when expanding history, because
that's where expansion starts from.  After the patch, there is no such
code.  The pointer ought to move back to the beginning of the word
being expanded, as it is with other forms of expansion.

-zefram



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