From c9148677771aa64b1169866b9631a2b5946ca79e Mon Sep 17 00:00:00 2001 From: teramako Date: Sat, 22 Nov 2008 18:52:52 +0000 Subject: follow CVS HEAD git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24670 d0d07461-0603-4401-acd4-de1884942a52 --- copy.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'copy.js') diff --git a/copy.js b/copy.js index e42910c..d58aafe 100644 --- a/copy.js +++ b/copy.js @@ -82,21 +82,18 @@ commands.addUserCommand(['copy'],'Copy to clipboard', function(args, special){ liberator.plugins.exCopy.copy(args.string, special); },{ - completer: function(filter, special){ + completer: function(context, arg, special){ if (special){ - return completion.javascript(filter); + completion.javascript(context); + return; } + context.title = ['Template','Value']; var templates = liberator.globalVariables.copy_templates.map(function(template) [template.label, liberator.modules.util.escapeString(template.value, '"')] ); - if (!filter){ return [0,templates]; } + if (!context.filter){ context.items = templates; return; } var candidates = []; - templates.forEach(function(template){ - if (template[0].toLowerCase().indexOf(filter.toLowerCase()) == 0){ - candidates.push(template); - } - }); - return [0, candidates]; + context.items = completion.filter(templates, context.filter, true); }, bang: true } @@ -148,7 +145,7 @@ var exCopyManager = { var isError = false; if (special && arg){ try { - copyString = window.eval('with(liberator){' + arg + '}'); + copyString = liberator.eval( arg); switch (typeof copyString){ case 'object': copyString = copyString === null ? 'null' : copyString.toSource(); -- cgit v1.2.3