Changeset 9027

Show
Ignore:
Timestamp:
04/07/08 01:02:44 (5 years ago)
Author:
drry
Message:

lang/javascript/userscripts/minibuffer.user.js:

  • fixed regexps.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/minibuffer.user.js

    r8961 r9027  
    1717          this.key = this.orig_string.replace(/[ACMS]-/g,''); 
    1818  }, 
    19   has: function(modifier){return this.orig_string.indexOf(modifier) != -1}, 
     19  has: function(modifier){return this.orig_string.indexOf(modifier) > -1}, 
    2020  equal: function (e, ch){ 
    2121          return (this.key == ch && 
     
    597597  }, 
    598598  bindBackwardWord: function(){ 
    599           var i=this.html.input, l=i.value.slice(0,i.selectionStart).replace(/[a-zA-Z0-9]*$|[^a-zA-Z0-9]*$/,'').length; 
     599          var i=this.html.input, l=i.value.slice(0,i.selectionStart).replace(/[a-zA-Z0-9]+$|[^a-zA-Z0-9]+$/,'').length; 
    600600          i.setSelectionRange(l,l); 
    601601  }, 
     
    610610  bindDeleteBackwardWord: function(){ 
    611611          var i=this.html.input, b=i.selectionStart, e=i.selectionEnd; 
    612           var tx = i.value, tr=tx.slice(0,b-1).replace(/[^a-zA-Z0-9]*$/,'').replace(/[a-zA-Z0-9]*$/,''), l=tr.length; 
     612          var tx = i.value, tr=tx.slice(0,b-1).replace(/[^a-zA-Z0-9]+$/,'').replace(/[a-zA-Z0-9]+$/,''), l=tr.length; 
    613613          i.value = tr+tx.slice(e); 
    614614          i.setSelectionRange(l,l); 
     
    814814                        font-size : 500%; 
    815815                        z-index : 10000; 
    816                          
     816 
    817817                        padding : 50px; 
    818818                        left : 50%; 
    819819                        top : 50%; 
    820820                        margin : -1em; 
    821                          
     821 
    822822                        background-color : #444; 
    823823                        color : #FFF; 
     
    11281128                context = context['context']; 
    11291129        } 
    1130          
     1130 
    11311131        if (!context) context = document; 
    11321132        var exp = (context.ownerDocument || context).createExpression(exp, function (prefix) { 
     
    14171417 
    14181418String.prototype.escapeRegexp = function(){ 
    1419         return this.replace(/^\?/, '.?').replace(/^\*/, '.*').replace(/\|/g,'\\|').replace(/\+/g,'\\+').replace(/\([^)]*$/, '').replace(/\[[^\]]*$/, ''); 
     1419        return this.replace(/^(?=[?*])/, '.').replace(/(?=[|+])/g, '\\').replace(/\([^)]*$/, '').replace(/\[[^\]]*$/, ''); 
    14201420} 
    14211421Array.prototype.position = function(obj){