From b3bd606ea321b3efc6337309192152cc1bb2431b Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 15 Nov 2008 06:22:19 +0000 Subject: 小さな修正&文字列での関数生成を行わないように git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@23762 d0d07461-0603-4401-acd4-de1884942a52 --- localkeymode.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'localkeymode.js') diff --git a/localkeymode.js b/localkeymode.js index bc93ac1..65b4c22 100644 --- a/localkeymode.js +++ b/localkeymode.js @@ -80,8 +80,8 @@ liberator.plugins.LocalKeyMode = (function() { var _enableTabs = []; var _names; - var feedkeysfuncName = typeof liberator.modules != 'undefined' ? - 'liberator.modules.events.feedkeys' : 'liberator.events'; + var feedKeys = liberator.modules ? liberator.modules.events.feedkeys + : liberator.events.feedkeys; // utility function function cloneMap(org) { return new Map( @@ -174,13 +174,12 @@ liberator.plugins.LocalKeyMode = (function() { if (!extra || !extra.rhs) extra.rhs = (item[1]+'').replace(rhsRegExp, ' '); if (typeof command != 'function') { + let commandName = command; if (command.charAt(0) == ':') - command = new Function( extra.noremap ? - 'commandline.open("", "'+command+'", modes.EX);' : - 'liberator.execute("'+command+'");' ); + command = extra.noremap ? function () commandline.open("", commandName, modes.EX) + : function () liberator.execute(commandName); else - command = new Function([ feedkeysfuncName, '("', command, '", ', - (extra.noremap ? true : false), ', true)'].join('') ); + command = function () feedKeys(command, extra.noremap, true); } keymaps.push(new Map([modes.NORMAL], key, 'localkeymap', command, extra) ); } -- cgit v1.2.3