Indentation respects tab stops now, fix #2672

This commit is contained in:
Maximilian Schüßler
2014-06-23 22:57:48 +02:00
committed by Ben Ogle
parent b744997201
commit 381d5b91b2
2 changed files with 4 additions and 3 deletions

View File

@@ -416,9 +416,10 @@ class Editor extends Model
@displayBuffer.indentLevelForLine(line)
# Constructs the string used for tabs.
buildIndentString: (number) ->
buildIndentString: (number, column=0) ->
if @getSoftTabs()
_.multiplyString(" ", Math.floor(number * @getTabLength()))
tabStopViolation = column % @getTabLength()
_.multiplyString(" ", Math.floor(number * @getTabLength()) - tabStopViolation)
else
_.multiplyString("\t", Math.floor(number))

View File

@@ -392,7 +392,7 @@ class Selection extends Model
if autoIndent and delta > 0
@insertText(@editor.buildIndentString(delta))
else
@insertText(@editor.getTabText())
@insertText(@editor.buildIndentString(1, @cursor.getBufferColumn()))
else
@indentSelectedRows()