mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user