Update dispass_completer for new completers

Update `dispass_completer' for the latest Conkeror. Conkeror changed the
API for the completers somewhat so the completions were broken.
This commit is contained in:
Tom Willemse 2014-06-15 23:58:33 +02:00
parent 6e73d17650
commit b618a79a48

View file

@ -53,9 +53,17 @@ function dispass(label, password)
yield co_return(data); yield co_return(data);
} }
function dispass_complete(input, pos, conservative) function dispass_completer()
{ {
if (pos == 0 && conservative) keywords(arguments);
completer.call(this, forward_keywords(arguments));
}
dispass_completer.prototype = {
constructor: dispass_completer,
__proto__: completer.prototype,
toString: function () "#<dispass_completer>",
complete: function (input, pos) {
if (pos == 0)
yield co_return(undefined); yield co_return(undefined);
let str = input.substring(0, pos); let str = input.substring(0, pos);
@ -78,13 +86,10 @@ function dispass_complete(input, pos, conservative)
ret.push(match[1].trim()); ret.push(match[1].trim());
}); });
let c = { count: ret.length, yield co_return(new completions(this, ret));
get_string: function (i) ret[i],
get_description: function (i) "",
get_input_state: function (i) [ret[i]] };
yield co_return(c);
} }
} }
};
function dispass_interactive(with_submit) { function dispass_interactive(with_submit) {
return function (I) { return function (I) {
@ -95,7 +100,7 @@ function dispass_interactive(with_submit) {
let label = yield I.minibuffer.read( let label = yield I.minibuffer.read(
$prompt="label:", $auto_complete=true, $prompt="label:", $auto_complete=true,
$completer=dispass_complete $completer=new dispass_completer()
); );
I.minibuffer.input_element.type = "password"; I.minibuffer.input_element.type = "password";