From 4eeecdf1d4f0ed70777bf99dc0b8c3b4108d27c5 Mon Sep 17 00:00:00 2001 From: teramako Date: Thu, 27 Nov 2008 02:59:23 +0000 Subject: follow CVS HEAD (fix: command argument and completer) git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25054 d0d07461-0603-4401-acd4-de1884942a52 --- copy.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'copy.js') diff --git a/copy.js b/copy.js index 48a8942..0934b38 100644 --- a/copy.js +++ b/copy.js @@ -79,11 +79,11 @@ liberator.globalVariables.copy_templates.forEach(function(template){ // used when argument is none //const defaultValue = templates[0].label; commands.addUserCommand(['copy'],'Copy to clipboard', - function(args, special){ - liberator.plugins.exCopy.copy(args.string, special); + function(args){ + liberator.plugins.exCopy.copy(args.string, args.bang); },{ - completer: function(context, arg, special){ - if (special){ + completer: function(context, args){ + if (args.bang){ completion.javascript(context); return; } @@ -93,7 +93,12 @@ commands.addUserCommand(['copy'],'Copy to clipboard', ); if (!context.filter){ context.completions = templates; return; } var candidates = []; - context.completions = completion.filter(templates, context.filter, true); + var filter = context.filter.toLowerCase(); + templates.forEach(function(template){ + if (template[0].toLowerCase().indexOf(filter) == 0) + candidates.push(template); + }); + context.completions = candidates; }, bang: true } -- cgit v1.2.3