mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Base first line delta on the cursor column, not the existing line's indent
This commit is contained in:
@@ -159,10 +159,12 @@ class Selection
|
||||
textPrecedingCursor = @editSession.buffer.getTextInRange([[currentBufferRow, 0], [currentBufferRow, currentBufferColumn]])
|
||||
insideExistingLine = textPrecedingCursor.match(/\S/)
|
||||
|
||||
if insideExistingLine or not @editSession.autoIndent
|
||||
if insideExistingLine
|
||||
desiredBase = @editSession.indentationForBufferRow(currentBufferRow)
|
||||
else
|
||||
else if @editSession.autoIndent
|
||||
desiredBase = @editSession.suggestedIndentForBufferRow(currentBufferRow)
|
||||
else
|
||||
desiredBase = currentBufferColumn
|
||||
|
||||
currentBase = lines[0].match(/\s*/)[0].length
|
||||
delta = desiredBase - currentBase
|
||||
@@ -172,7 +174,8 @@ class Selection
|
||||
if insideExistingLine
|
||||
firstLineDelta = -line.length # remove all leading whitespace
|
||||
else
|
||||
firstLineDelta = delta - @editSession.indentationForBufferRow(currentBufferRow)
|
||||
firstLineDelta = delta - currentBufferColumn
|
||||
|
||||
normalizedLines.push(@adjustIndentationForLine(line, firstLineDelta))
|
||||
else
|
||||
normalizedLines.push(@adjustIndentationForLine(line, delta))
|
||||
|
||||
Reference in New Issue
Block a user