stickshift.js
function CodeMirror(place, options) {
    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);

    this.options = options = options ? copyObj(options) : {};
    // Determine effective options based on given values and defaults.
    copyObj(defaults, options, false);
    setGuttersForLineNumbers(options);

    var doc = options.value;
    if (typeof doc == "string") doc = new Doc(doc, options.mode);
    this.doc = doc;

    var display = this.display = new Display(place, doc);
    display.wrapper.CodeMirror = this;
    updateGutters(this);
    themeChanged(this);
    if (options.lineWrapping)
      this.display.wrapper.className += " CodeMirror-wrap";
    if (options.autofocus && !mobile) focusInput(this);
    initScrollbars(this);

    this.state = {
      keyMaps: [],  // stores maps added by addKeyMap
      overlays: [], // highlighting overlays, as added by addOverlay
      modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
      overwrite: false, focused: false,
      suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
      pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput
      draggingText: false,
      highlight: new Delayed(), // stores highlight worker timeout
      keySeq: null  // Unfinished key sequence
    };

    // Override magic textarea content restore that IE sometimes does
    // on our hidden textarea on reload
    if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);

    registerEventHandlers(this);
    ensureGlobalHandlers();

    startOperation(this);
    this.curOp.forceUpdate = true;
    attachDoc(this, doc);

    if ((options.autofocus && !mobile) || activeElt() == display.input)
      setTimeout(bind(onFocus, this), 20);
    else
      onBlur(this);

    for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
      optionHandlers[opt](this, options[opt], Init);
    maybeUpdateLineNumberWidth(this);
    if (options.finishInit) options.finishInit(this);
    for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
    endOperation(this);
    // Suppress optimizelegibility in Webkit, since it breaks text
    // measuring on line wrapping boundaries.
    if (webkit && options.lineWrapping &&
        getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
      display.lineDiv.style.textRendering = "auto";
  }
function CodeMirror(place, options) {
    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);

    this.options = options = options ? copyObj(options) : {};
    // Determine effective options based on given values and defaults.
    copyObj(defaults, options, false);
    setGuttersForLineNumbers(options);

    var doc = options.value;
    if (typeof doc == "string") doc = new Doc(doc, options.mode);
    this.doc = doc;

    var display = this.display = new Display(place, doc);
    display.wrapper.CodeMirror = this;
    updateGutters(this);
    themeChanged(this);
    if (options.lineWrapping)
      this.display.wrapper.className += " CodeMirror-wrap";
    if (options.autofocus && !mobile) focusInput(this);
    initScrollbars(this);

    this.state = {
      keyMaps: [],  // stores maps added by addKeyMap
      overlays: [], // highlighting overlays, as added by addOverlay
      modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
      overwrite: false, focused: false,
      suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
      pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in readInput
      draggingText: false,
      highlight: new Delayed(), // stores highlight worker timeout
      keySeq: null  // Unfinished key sequence
    };

    // Override magic textarea content restore that IE sometimes does
    // on our hidden textarea on reload
    if (ie && ie_version < 11) setTimeout(bind(resetInput, this, true), 20);

    registerEventHandlers(this);
    ensureGlobalHandlers();

    startOperation(this);
    this.curOp.forceUpdate = true;
    attachDoc(this, doc);

    if ((options.autofocus && !mobile) || activeElt() == display.input)
      setTimeout(bind(onFocus, this), 20);
    else
      onBlur(this);

    for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
      optionHandlers[opt](this, options[opt], Init);
    maybeUpdateLineNumberWidth(this);
    if (options.finishInit) options.finishInit(this);
    for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
    endOperation(this);
    // Suppress optimizelegibility in Webkit, since it breaks text
    // measuring on line wrapping boundaries.
    if (webkit && options.lineWrapping &&
        getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
      display.lineDiv.style.textRendering = "auto";
  }
function CodeMirror ( place , options ) { if ( ! ( this instanceof CodeMirror ) ) return new CodeMirror ( place , options ) ; this . options = options = options ? copyObj ( options ) : { } ; // Determine effective options based on given values and defaults. copyObj ( defaults , options , false ) ; setGuttersForLineNumbers ( options ) ; var doc = options . value ; if ( typeof doc == "string" ) doc = new Doc ( doc , options . mode ) ; this . doc = doc ; var display = this . display = new Display ( place , doc ) ; display . wrapper . CodeMirror = this ; updateGutters ( this ) ; themeChanged ( this ) ; if ( options . lineWrapping ) this . display . wrapper . className += " CodeMirror-wrap" ; if ( options . autofocus && ! mobile ) focusInput ( this ) ; initScrollbars ( this ) ; this . state = { keyMaps : [ ] , // stores maps added by addKeyMap overlays : [ ] , // highlighting overlays, as added by addOverlay modeGen : 0 , // bumped when mode/overlay changes, used to invalidate highlighting info overwrite : false , focused : false , suppressEdits : false , // used to disable editing during key handlers when in readOnly mode pasteIncoming : false , cutIncoming : false , // help recognize paste/cut edits in readInput draggingText : false , highlight : new Delayed ( ) , // stores highlight worker timeout keySeq : null // Unfinished key sequence } ; // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if ( ie && ie_version < 11 ) setTimeout ( bind ( resetInput , this , true ) , 20 ) ; registerEventHandlers ( this ) ; ensureGlobalHandlers ( ) ; startOperation ( this ) ; this . curOp . forceUpdate = true ; attachDoc ( this , doc ) ; if ( ( options . autofocus && ! mobile ) || activeElt ( ) == display . input ) setTimeout ( bind ( onFocus , this ) , 20 ) ; else onBlur ( this ) ; for ( var opt in optionHandlers ) if ( optionHandlers . hasOwnProperty ( opt ) ) optionHandlers [ opt ] ( this , options [ opt ] , Init ) ; maybeUpdateLineNumberWidth ( this ) ; if ( options . finishInit ) options . finishInit ( this ) ; for ( var i = 0 ; i < initHooks . length ; ++ i ) initHooks [ i ] ( this ) ; endOperation ( this ) ; // Suppress optimizelegibility in Webkit, since it breaks text // measuring on line wrapping boundaries. if ( webkit && options . lineWrapping && getComputedStyle ( display . lineDiv ) . textRendering == "optimizelegibility" ) display . lineDiv . style . textRendering = "auto" ; }
A CodeMirror instance represents an editor. This is the object that user code is usually dealing with.
A CodeMirror instance represents an editor . This is the object that user code is usually dealing with .