diff --git a/lib/codemirror.js b/lib/codemirror.js
index <HASH>..<HASH> 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -700,7 +700,7 @@ window.CodeMirror = (function() {
   // parse correctly.
   function findStartLine(doc, n) {
     var minindent, minline;
-    for (var search = n, lim = n - 40; search > lim; --search) {
+    for (var search = n, lim = n - 100; search > lim; --search) {
       if (search == 0) return 0;
       var line = getLine(doc, search-1);
       if (line.stateAfter) return search;
Increase getStateBefore's scan limit