daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest May 26th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -r bc3047f2e894 char-hints-mod2.js
  2. --- a/char-hints-mod2.js    Fri May 21 23:26:09 2010 +0900
  3. +++ b/char-hints-mod2.js    Sat May 22 11:58:08 2010 +0900
  4. @@ -71,6 +71,31 @@
  5.  //}}}
  6.  
  7.  (function () {
  8. +    (function(){
  9. +        //override _showHints
  10. +        const key = "Hints.prototype._showHints";
  11. +        let conf = userContext[key],original;
  12. +        if(conf) original = conf;
  13. +        else original = userContext[key] = Hints.prototype._showHints;
  14. +
  15. +        const target = "String(hintnum).indexOf(String(activeHint)) == 0";
  16. +
  17. +        let source = original.toSource();
  18. +        if(source.indexOf(target)>=0){
  19. +            source = source.replace(target,
  20. +                "num2chars(hintnum).indexOf(num2chars(activeHint)) == 0");
  21. +            Hints.prototype._showHints = eval("(function() "+source+")()");
  22. +        }else{
  23. +            liberator.echoerr(new Error("_showHints override failed!"));
  24. +        }
  25. +    })()
  26. +    ;
  27. +    (function(){
  28. +        const source = Hints.prototype._checkUnique.toSource();
  29. +        if(source.indexOf("10")<0) return;
  30. +        Hints.prototype._checkUnique = eval("(function() "+source.replace("10",<>hintchars.length</>)+")()");
  31. +    })()
  32. +    ;
  33.  
  34.      const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB";
  35.      const hintContext = modules.hints;
  36. @@ -173,40 +198,15 @@
  37.      } //}}}
  38.      function processHintInput(hintInput, hints) //{{{
  39.      {
  40. -        if (timer) {
  41. -            clearTimeout(timer);
  42. -            timer = null;
  43. -        }
  44.          let start = getStartCount(hintchars.length, hints.length);
  45.          let num = chars2num(hintInput)-start;
  46.          if(num < 0) return;
  47.  
  48. -        let numstr = String(num);
  49. -        for(let i=0,l=numstr.length;i<l;++i) {
  50. -            let num = numstr[i];
  51. -            // events.toString(e) return e.liberatorString
  52. -            // if e.liberatorString.
  53. -            // so alt handled as press number event by vimperator.
  54. -            let alt = new Object;
  55. -            alt.liberatorString = num;
  56. -            charhints.original.onEvent.apply(hintContext,[alt]);
  57. -        }
  58. -        clearOriginalTimeout();
  59. +        hintContext._hintNumber = Math.floor(num/10);
  60. +        charhints.original.onEvent.apply(hintContext,[{
  61. +            liberatorString: String(num%10)
  62. +        }]);
  63.          statusline.updateInputBuffer(hintInput);
  64. -
  65. -        let validHints = hints.filter(function(hint) isValidHint(hintInput, hint));
  66. -        if(validHints.length == 1) {
  67. -            charhints.original.processHints.apply(hintContext,[true]);
  68. -            return true;
  69. -        }
  70. -
  71. -        let timeout = options["hinttimeout"];
  72. -        if (timeout > 0) {
  73. -            timer = setTimeout(function () {
  74. -                charhints.original.processHints.apply(hintContext,[true]);
  75. -            }, timeout);
  76. -        }
  77. -
  78.      } //}}}
  79.  
  80.      var hintInput = "";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top