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

Re: PATCH: revamped history-search-{for,back}ward for 3.1.4



On Jun 9,  3:42pm, Wayne Davison wrote:
} Subject: PATCH: revamped history-search-{for,back}ward for 3.1.4
}
} > It's my assertion that history-search-*ward are now broken and
} > should be made to behave the way they used to (but not implemented
} > the way they used to be implemented).
} 
} My idea is that most of the time the search gets initialized when we
} first leave the "curhist" line, and then we continue to execute the
} last search when we're moving around in the history.

Unfortunately, this doesn't work right.  Consider what happens in the
following case, where <M-p> is history-search-backward and <C-p> is
up-line-or-history:

zsh% ech<M-p>
zsh% echo this is a test<C-p>
zsh% fc -R historytest<M-p>

At the second <M-p>, `histpos' remains 3 (the length of "ech"), but the
first three characters of `line' are "fc ".  As a result, the wrong string
is searched for.  This is very similar to the bug that Zefram's patch
from a year and a half ago was supposed to fix; it just isn't sufficient
to remember and re-use only the `histpos'.

You can do a little better if you also save `hl' and reset the search if 
`histline' differs from the last time through, but that's still not quite
right.

} I happened to find and fix a few other minor problems in zle_hist.c,
} but I'll send that stuff separately from this.

Looking forward to it.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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