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

Re: matlab-history-beginning-search-backward



Guido van Steen wrote:
> * Which part of the code makes sure that the commands retrieved
> from history are "shown" on the command line?

Assigning to HISTNO moves to the given line number in the history.  zsh
remembers edits to history lines until you hit <return> on the line you
actually want to execute; the next time you look at the history it's
back the way it was.

> * 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?

As far as the widget is concerned, the cursor position only matters at
the start in order to find the string to the left which is used for the
search.  If you execute the widget again (forward or backward) without
any other command in between it will use the same search string (no
matter where the cursor is).  If you move the cursor (or in fact execute
any other command) and execute the widget again it will look again at
the string to the left.

Some people like the cursor placed specially after the execution of
history commands; this function doesn't have any support for that, so
it's always left at the end.

-- 
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