Thank you Peter, I amended the widget slightly. With this version the searched pattern is shown again when you search-forward beyond the first match. As far as I can tell that is how history works in Matlab and Fish. Attached for users who also like this behavior. Best wishes, Guido --- On Fri, 10/2/09, Peter Stephenson <pws@xxxxxxx> wrote: > From: Peter Stephenson <pws@xxxxxxx> > Subject: Re: matlab-history-beginning-search-backward > To: zsh-users@xxxxxxxxxx > Date: Friday, October 2, 2009, 10:48 AM > 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 >
Attachment:
history-substring-search-backward
Description: Binary data