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

Re: PATCH: documentation for new _history_complete_word



Adam Spiers wrote:
> This patch should only be applied at the same time as my rewrite of
> _history_complete_word.  The rewrite didn't make it into pws-6

I've added this now (the rest of you will have to extract it by hand from
8028 in some MIME-aware way).  It has the unfortunate effect that menu
completion is turned off unless history_stop is set, even if you usually
have it on.  The following seems to fix that.  But it still seems not to
respect option settings properly.  With no menu behaviour at all, instead
of getting a complete set of possible completions, maybe with autolisting,
as you would expect, you get only the last completion.  Shouldn't it just
forget about newer and older in this case and add the lot?  (I haven't even
looked at what happens with automenu.)

A couple of other things

- probably it should return status 1 when it gets to the end of the list
  in either direction so that the shell can beep if appropriate.  It might
  be neat to do this if and only if HIST_BEEP is set.
- There's probably a better way of doing the checking for which direction
  to move.  The usual way would be to check $WIDGET, but then you
  have to add the other widget by hand using zle -C.  Maybe we can think
  of an extension to compdef which would allow you to define both
  in the top line, with default bindings.  In fact, it would be handy
  to have a way of defining command widgets to use multiple types
  of completion, so you can get listing as well as completing behaviour
  from the same function with no extra work.

--- Completion/Commands/_history_complete_word.bak	Mon Sep 27 16:00:42 1999
+++ Completion/Commands/_history_complete_word	Mon Sep 27 16:25:34 1999
@@ -36,7 +36,8 @@
 
   [[ -z "$compconfig[history_list]" ]] && compstate[list]=''
 
-  if [[ -n "$compstate[old_list]" && -n "$compconfig[history_stop]" ]]; then
+  if [[ -n "$compstate[old_list]" &&
+    ( -n "$compconfig[history_stop]" || "$compstate[insert]" = menu ) ]]; then
     # array of matches is newest -> oldest (reverse of history order)
     if [[ "$direction" == 'older' ]]; then
       if [[ compstate[old_insert] -eq $_hist_menu_length ||

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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