From fa402e02902722748a66f4be0fa1f6740d763ba1 Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 22 May 2010 03:23:18 +0000 Subject: Caisui さんの修正パッチ Thanks! http://gist.github.com/409711 http://d.hatena.ne.jp/caisui/searchdiary?word=char-hints-mod2&.submit=%B8%A1%BA%F7&type=detail git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37683 d0d07461-0603-4401-acd4-de1884942a52 --- char-hints-mod2.js | 58 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'char-hints-mod2.js') diff --git a/char-hints-mod2.js b/char-hints-mod2.js index 8bb373b..a5bd246 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -71,6 +71,31 @@ let g:hintlabeling: //}}} (function () { + (function(){ + //override _showHints + const key = "Hints.prototype._showHints"; + let conf = userContext[key],original; + if(conf) original = conf; + else original = userContext[key] = Hints.prototype._showHints; + + const target = "String(hintnum).indexOf(String(activeHint)) == 0"; + + let source = original.toSource(); + if(source.indexOf(target)>=0){ + source = source.replace(target, + "num2chars(hintnum).indexOf(num2chars(activeHint)) == 0"); + Hints.prototype._showHints = eval("(function() "+source+")()"); + }else{ + liberator.echoerr(new Error("_showHints override failed!")); + } + })() + ; + (function(){ + const source = Hints.prototype._checkUnique.toSource(); + if(source.indexOf("10")<0) return; + Hints.prototype._checkUnique = eval("(function() "+source.replace("10",<>hintchars.length)+")()"); + })() + ; const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB"; const hintContext = modules.hints; @@ -173,40 +198,15 @@ let g:hintlabeling: } //}}} function processHintInput(hintInput, hints) //{{{ { - if (timer) { - clearTimeout(timer); - timer = null; - } let start = getStartCount(hintchars.length, hints.length); let num = chars2num(hintInput)-start; if(num < 0) return; - let numstr = String(num); - for(let i=0,l=numstr.length;i 0) { - timer = setTimeout(function () { - charhints.original.processHints.apply(hintContext,[true]); - }, timeout); - } - } //}}} var hintInput = ""; -- cgit v1.2.3