mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Update option to preserveLeadingWhitespace
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user