char-hints-mod2 と 2.3

rev36536を利用していて気になる点があったのいじってみた。


2.3 で hintStringでも 絞り込みを行なうようになった点についてです。

が「J」で

となってしまいます。


これは、標準のhintchars で Jは1に相当するので、
1(=J),10(=U),11(=I),12(=O),.. と絞り込まれているためです。
(このまま気にせず、「JJ」にすれば問題無く動作します)


そこで


に修正します。


Hints._showHints を弄ってます。

--- a.js	2010-01-26 11:36:07.000000000 +0900
+++ b.js	2010-04-12 22:21:21.073762400 +0900
@@ -71,6 +71,24 @@
 //}}}
 
 (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!"));
+        }
+    })();
 
     const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB";
     const hintContext = modules.hints;

やってることは Hints の _showHints に対して
String(hintnum).indexOf(String(activeHint)) == 0

num2chars(hintnum).indexOf(num2chars(activeHint)) == 0 に 変更しつつ
スコープを char-hints-mod2 内なるようにしてます。


なお、hintString.length>0 な状態で を 押すと
意図していないであろうhintがアクティブになりますが、
char-hints-mod2 が 無くても発生するので本体の問題だと思います。


画像がでかい…(;´д`)
これリンク先の50%程度のサイズにできないのかなぁ


2010.04.14
環境依存部位の除去漏れを修正しました。
key が undefined@@ に なってました。