Let completion functions set the match_required state.
commit2005f2e5f2ec809f8733886714b61a389cf2b10b
authorDavid Kettler <kettler@internode.on.net>
Fri, 8 May 2009 03:33:37 +0000 (8 13:03 +0930)
committerDavid Kettler <kettler@internode.on.net>
Wed, 18 Nov 2009 13:19:06 +0000 (18 23:49 +1030)
treecd9e9a3c9b90c1a2ae9487b6746698613e24a6c9
parent2a7f832c3656f9473f1d051db28b419a7ab2f7e6
Let completion functions set the match_required state.

Currently the match_required state is set at the beginning when input
is being read.  This commit allows completers to change that state
during the input.  In particular, this can be used to allow a webjump
with a limited set of valid inputs to prevent invalid inputs from
being accepted.

For example, the following webjump can now be defined and will only
allow valid bookmarks to be chosen.  Without $match_required, the webjump
will try to visit any arbitrary input, which is confusing and not useful.

  /* Access bookmarks via completion from a webjump. */
  define_webjump("bookmark",
                 function(term) {return term;},
                 $completer = history_completer($use_history = false,
                                                $use_bookmarks = true,
                                                $match_required = true));

Another example is in the upcoming index webjump feature.
modules/history.js
modules/minibuffer-completion.js
modules/minibuffer-read.js