diff options
author | teramako | 2008-11-22 18:52:52 +0000 |
---|---|---|
committer | teramako | 2008-11-22 18:52:52 +0000 |
commit | c9148677771aa64b1169866b9631a2b5946ca79e (patch) | |
tree | c1a85ee56c292f03da71a776598a489b5cead395 /copy.js | |
parent | f00e74fa01b8a926694f9775e29c5d63010b8d6e (diff) | |
download | vimperator-plugins-c9148677771aa64b1169866b9631a2b5946ca79e.tar.bz2 |
follow CVS HEAD
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24670 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'copy.js')
-rw-r--r-- | copy.js | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -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(); |