[Vimperator] uppercase test only when alpha are existent

calmar mac at calmar.ws
Mon Jul 2 17:49:10 PDT 2007


Hi,

I have not much knowledge about javascript. You may need to 'redo'
it to some degree (put the check into a seperate function or
however).

It's not even worth a patch I think, so I paste it here:

It checks in vimperator.js (my lines have a +) :

else // this key completed a quick hint
{
    // if the hint is all in UPPERCASE, open it in new tab
    vimperator.input.buffer += key;

+    var validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+    var hasAlpha=false;
+    var currentChar;
+
+    for (i = 0; i < vimperator.input.buffer.length && !hasAlpha ; i++) 
+    { 
+        currentChar = vimperator.input.buffer.charAt(i); 
+        if (validChars.indexOf(currentChar) >= 0) 
+        {
+            hasAlpha = true;
+        }
+    }
+
+    if ( hasAlpha && vimperator.input.buffer.toUpperCase() == vimperator.input.buffer)
        vimperator.hints.openHints(true, false);
    else // open in current window
        vimperator.hints.openHints(false, false);


if the buffer has any Alpha-Charaters in it. If not, it should not
open a new tab (it should use false as the first argument in
vimperator.hints.openHints(false,false)

E.g. when I set hintchars=0123456789 I want *not* a 'new-tab' to
my default, therefore the tweak above.

cheers
marco candrian




-- 
   (o_  It rocks: LINUX + Command-Line-Interface
   //\
   V_/_                     http://www.calmar.ws


More information about the Vimperator mailing list