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

Re: matlab-history-beginning-search-backward



Dear Peter, 

I am impressed by the code. It works well - apart from the 
cursor stuff. I tried to understand it, but I failed. 

I have two questions: 

* Which part of the code makes sure that the commands retrieved 
from history are "shown" on the command line? 

* Why does the cursor position matter, and how can one make sure 
that the cursor moves to the right position before the widget is 
invoked? 

Best wishes, 

Guido 

--- On Thu, 10/1/09, Peter Stephenson <pws@xxxxxxx> wrote:

> From: Peter Stephenson <pws@xxxxxxx>
> Subject: Re: matlab-history-beginning-search-backward
> To: zsh-users@xxxxxxxxxx
> Date: Thursday, October 1, 2009, 10:38 AM
> Peter Stephenson wrote:
> > I stole a lot of it from
> > history-beginning-search-menu.
> 
> ... and I've just noticed because of that a couple of bits
> are nonsense ...
> 
> > local search=$LBUFFER MATCH MBEGIN MEND
> 
> ... this assignment is redundant ...
> 
> > # Filter out any match that's the same as the
> original.
> > # Note this isn't a pattern this time.
> > matches=(${matches:#${LBUFFER}})
> 
> ... more importantly, because in this case $matches is an
> array of
> numbers this doesn't do anything (except stop you from
> matching a
> history line whose number happens to match the string to
> the left of the
> cursor).  This filter would need to be moved up to
> where the matching is
> originally done.  It's minor, though.
> 
> -- 
> Peter Stephenson <pws@xxxxxxx> 
>           Software Engineer
> Tel: +44 (0)1223 692070         
>          Cambridge Silicon
> Radio Limited
> Churchill House, Cambridge Business Park, Cowley Road,
> Cambridge, CB4 0WZ, UK
> 
> 
> 
> 
> Member of the CSR plc group of companies. CSR plc
> registered in England and Wales, registered number 4187346,
> registered office Churchill House, Cambridge Business Park,
> Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> 






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