Update option to preserveLeadingWhitespace

This commit is contained in:
Kevin Sawicki
2014-03-19 10:05:29 -07:00
parent 7c17c99b9e
commit 9fce23d5ac
2 changed files with 5 additions and 5 deletions

View File

@@ -374,10 +374,10 @@ class Editor extends Model
# bufferRow - A {Number} indicating the buffer row.
# newLevel - A {Number} indicating the new indentation level.
# options - An {Object} with the following keys:
# :ignoreLeadingWhitespace - true to not replace any of the leading
# whitespace already on the line (default: false)
setIndentationForBufferRow: (bufferRow, newLevel, {ignoreLeadingWhitespace}={}) ->
if ignoreLeadingWhitespace
# :preserveLeadingWhitespace - true to preserve any whitespace already on
# the line (default: false).
setIndentationForBufferRow: (bufferRow, newLevel, {preserveLeadingWhitespace}={}) ->
if preserveLeadingWhitespace
endColumn = 0
else
endColumn = @lineForBufferRow(bufferRow).match(/^\s*/)[0].length

View File

@@ -301,7 +301,7 @@ class Selection
if options.autoIndent
@editor.autoIndentBufferRow(row) for row in newBufferRange.getRows()
else if options.autoIndentNewline and text == '\n'
@editor.autoIndentBufferRow(newBufferRange.end.row, ignoreLeadingWhitespace: true)
@editor.autoIndentBufferRow(newBufferRange.end.row, preserveLeadingWhitespace: true)
else if options.autoDecreaseIndent and /\S/.test text
@editor.autoDecreaseIndentForBufferRow(newBufferRange.start.row)