diff --git a/lib/codemirror.js b/lib/codemirror.js
index c3f9370b20586124322bf354231d4df93676d3ed..2df5b79d778326a426d10bbc3a9683054c29ebd1 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -2580,7 +2580,7 @@ window.CodeMirror = (function() {
     flattenSpans: true,
     pollInterval: 100,
     undoDepth: 40,
-    viewportMargin: 100,
+    viewportMargin: 10,
     tabindex: null,
     autofocus: null,
     lineNumberFormatter: function(integer) { return integer; }