diff options
| author | hogelog | 2008-12-12 20:11:07 +0000 | 
|---|---|---|
| committer | hogelog | 2008-12-12 20:11:07 +0000 | 
| commit | 5a76aed86e78251cff0e6aa6178cd4cb151355d3 (patch) | |
| tree | efd5de68c75d206a33c11b488bc1fded609a574b | |
| parent | 5dd40321e776b9fe2ae66efabcbc02d65cfceb5f (diff) | |
| download | vimperator-plugins-5a76aed86e78251cff0e6aa6178cd4cb151355d3.tar.bz2 | |
 * fix bug: mistake if hints>=10.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26596 d0d07461-0603-4401-acd4-de1884942a52
| -rw-r--r-- | char-hints-mod2.js | 33 | 
1 files changed, 21 insertions, 12 deletions
| diff --git a/char-hints-mod2.js b/char-hints-mod2.js index c1bed58..7b7afbe 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -10,13 +10,17 @@ var PLUGIN_INFO =      <detail><![CDATA[
  == Usage ==
 -lowercase => select hint-matcher.
 -UpperCase => select char-hint.
 +LowerCase => input hint command line.
 +UpperCase => select char-hint label.
 +
 +小文字は候補を絞るためのテキスト入力に使います。
 +大文字は文字ラベルの選択に使います。
  == OPTIONS ==
  set histchars="hjkl" => show char-hint use h, j, k, l.
 -let g:multi_requester_use_wedata = "false"             // true by default
 +== TODO ==
 + * support hinttimeout.
       ]]></detail>
  </VimperatorPlugin>;
  //}}}
 @@ -62,29 +66,34 @@ let g:multi_requester_use_wedata = "false"             // true by default      } //}}}
      let hintContext = hints.addMode;
 +    let hintChars = [];
      let charhints = plugins.charhints = {
          show: function(minor, filter, win) //{{{
          {
              charhints.original.show(minor, filter, win);
 +            hintChars = [];
              showCharHints();
          }, //}}}
          onInput: function(event) //{{{
          {
              let hintString = commandline.command;
              commandline.command = hintString.replace(/[A-Z]/g, "");
 +            charhints.original.onInput(event);
 +            showCharHints();
              for(let i=0;i<hintString.length;++i) {
                  if (/^[A-Z]$/.test(hintString[i])) {
 -                    let numstr = String(chars2num(hintString[i]));
 -                    for(let j=0;j<numstr.length;++j) {
 -                        let num = numstr[j];
 -                        let alt = new Object;
 -                        alt.liberatorString = num;
 -                        hints.onEvent(alt);
 -                    }
 +                    hintChars.push(hintString[i]);
 +                }
 +            }
 +            if(hintChars.length>0) {
 +                let numstr = String(chars2num(hintChars.join('')));
 +                for(let i=0;i<numstr.length;++i) {
 +                    let num = numstr[i];
 +                    let alt = new Object;
 +                    alt.liberatorString = num;
 +                    hints.onEvent(alt);
                  }
              }
 -            charhints.original.onInput(event);
 -            showCharHints();
          }, //}}}
      };
 | 
