zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: martin.ebourne@arcordia.com
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH: Re: Delaying menu completion
Date: Tue, 14 Aug 2001 16:03:36 +0000	[thread overview]
Message-ID: <1010814160337.ZM8501@candle.brasslantern.com> (raw)
In-Reply-To: <OF282F56AE.F70B2E05-ON80256AA8.002E05E6@uk.jpmorgan.com>

On Aug 14, 10:21am, martin.ebourne@arcordia.com wrote:
}
} Someone will need to check the patch because I don't fully understand
} what's going on - its a combination of cut & paste and trial & error coding
} in there. ;)

You don't want this line:

} +      [[ "$_old_match_string" = "$PREFIX$SUFFIX$HISTNO" &&

The _old_match_string variable is used only by the _match completer.
If you were to try using _approximate without _match, it would stop
working.  If you want this behavior, you should change the name to
_old_approx_string and also copy the code from _match that sets it.

} > } Problem 2
} > Unfortunately $compstate[old_list] is not available until after you
} > enter one of the completion widgets, so you're going to need a helper
} > function of some kind, that will be used as the non-menu completion
} > widget, and that sets a global variable that can be tested in place
} > of $compstate when you invoke _menu_or_down.
} 
} Ah, yes, that's what I needed.  [...]
} 
}    _is_completing() {
}      [[ $compstate[old_list] == shown ]] && _completing=1
}    }
}    zle -C is-completing complete-word _is_completing

I'd suggest

   _is_completing() {
     _completing=$compstate[old_list]
   }

That way you can differentiate "yes" and "shown" in case you don't have
autolist set, or are using bashautolist.

Also, I'm not entirely certain, but you may need/want to make it

   _is_completing() {
     _completing=$compstate[old_list]
     compstate[old_list]=keep
   }

The end result is probably the same, but keeping the old list will mean
that `zle menu-complete' doesn't have to recompute it.  (I'm actually
not entirely sure what happens to the list when you invoke a completion
widget from another zle widget, but the doc implies it'll be cleared
when the completion widget finishes if old_list is not keep.)

Also, setting old_list to keep causes the widget to correctly propagate
its exit status, should you end up wanting to test `if zle is-completing'
again at some point.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  parent reply	other threads:[~2001-08-14 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-14  9:21 martin.ebourne
2001-08-14 12:02 ` Sven Wischnowsky
2001-08-14 16:03 ` Bart Schaefer [this message]
2001-08-14 12:24 martin.ebourne
2001-08-16  9:51 martin.ebourne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010814160337.ZM8501@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=martin.ebourne@arcordia.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).