diff --git a/lib/ace/Document.js b/lib/ace/Document.js
index <HASH>..<HASH> 100644
--- a/lib/ace/Document.js
+++ b/lib/ace/Document.js
@@ -25,7 +25,7 @@ var Document = function(text, mode) {
     if (mode) {
         this.setMode(mode);
     }
-
+    
     if (lang.isArray(text)) {
         this.$insertLines(0, text);
     } else {
diff --git a/lib/ace/Editor.js b/lib/ace/Editor.js
index <HASH>..<HASH> 100644
--- a/lib/ace/Editor.js
+++ b/lib/ace/Editor.js
@@ -423,7 +423,7 @@ var Editor = function(renderer, doc) {
                             else
                                 break;
                         console.log("Indent " + indent + "(" + line.length + ")");
-                        if (line.length != 0)
+                        if (/[^\s]$/.test(line))
                             minIndent = Math.min(indent, minIndent);
                     }
                     console.log("min indent " + minIndent);
Small fix in audo-indentation.