diff --git a/lib/codemirror.js b/lib/codemirror.js
index <HASH>..<HASH> 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -60,7 +60,6 @@ window.CodeMirror = (function() {
                   draggingText: false,
                   highlight: new Delayed()};
 
-    this.nextOpId = 0;
     themeChanged(this);
     if (options.lineWrapping)
       this.display.wrapper.className += " CodeMirror-wrap";
@@ -1201,6 +1200,7 @@ window.CodeMirror = (function() {
   // be awkward, slow, and error-prone), but instead updates are
   // batched and then all combined and executed at once.
 
+  var nextOpId = 0;
   function startOperation(cm) {
     cm.curOp = {
       // An array of ranges of lines that have to be updated. See
@@ -1212,7 +1212,7 @@ window.CodeMirror = (function() {
       selectionChanged: false,
       updateMaxLine: false,
       updateScrollPos: false,
-      id: ++cm.nextOpId
+      id: ++nextOpId
     };
     if (!delayedCallbackDepth++) delayedCallbacks = [];
   }
Make sure operation ids aren't reused between editors

Issue #<I>