From 487245311e19c97eea893e012389f2b063597cb6 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 26 Oct 2012 11:52:37 -0600 Subject: [PATCH] `EditSession#indentLevelForLine` detects tabs/spaces for each line This allows folding, auto-indent, etc to work in a file in which *both* tabs and spaces are used to indent. Not that this is a good idea, but at least we handle it gracefully. --- src/app/edit-session.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 1515d6aa4..262607744 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -123,10 +123,10 @@ class EditSession @buffer.change([[bufferRow, 0], [bufferRow, currentIndentString.length]], newIndentString) indentLevelForLine: (line) -> - if @softTabs - line.match(/^\s*/)?[0].length / @tabLength - else + if line.match(/^\t/) line.match(/^\t*/)?[0].length + else + line.match(/^\s*/)?[0].length / @tabLength buildIndentString: (number) -> if @softTabs