public/javascripts/codemirror/js/editor.js
function(event) {
      var electric = Editor.Parser.electricChars, self = this;
      // Hack for Opera, and Firefox on OS X, in which stopping a
      // keydown event does not prevent the associated keypress event
      // from happening, so we have to cancel enter and tab again
      // here.
      if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) ||
          event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
          (event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default"))
        event.stop();
      else if (electric && electric.indexOf(event.character) != -1)
        this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
      else if ((event.character == "v" || event.character == "V")
               && (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V
        this.reroutePasteEvent();
    }
function(event) {
      var electric = Editor.Parser.electricChars, self = this;
      // Hack for Opera, and Firefox on OS X, in which stopping a
      // keydown event does not prevent the associated keypress event
      // from happening, so we have to cancel enter and tab again
      // here.
      if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) ||
          event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
          (event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default"))
        event.stop();
      else if (electric && electric.indexOf(event.character) != -1)
        this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
      else if ((event.character == "v" || event.character == "V")
               && (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V
        this.reroutePasteEvent();
    }
function ( event ) { var electric = Editor . Parser . electricChars , self = this ; // Hack for Opera, and Firefox on OS X, in which stopping a // keydown event does not prevent the associated keypress event // from happening, so we have to cancel enter and tab again // here. if ( ( this . frozen && ( ! this . keyFilter || this . keyFilter ( event . keyCode ) ) ) || event . code == 13 || ( event . code == 9 && this . options . tabMode != "default" ) || ( event . keyCode == 32 && event . shiftKey && this . options . tabMode == "default" ) ) event . stop ( ) ; else if ( electric && electric . indexOf ( event . character ) != - 1 ) this . parent . setTimeout ( function ( ) { self . indentAtCursor ( null ) ; } , 0 ) ; else if ( ( event . character == "v" || event . character == "V" ) && ( event . ctrlKey || event . metaKey ) && ! event . altKey ) // ctrl-V this . reroutePasteEvent ( ) ; }
Check for characters that should re-indent the current line, and prevent Opera from handling enter and tab anyway.
Check for characters that should re - indent the current line and prevent Opera from handling enter and tab anyway .