Paste indent normalization works with on lines w/ mixed indentation

Normalizing the indent no longer explodes when pasting on a line that has mixed tabs and spaces when the edit session is using hard tabs.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-12-06 11:53:57 -07:00
parent 9945c5ebbb
commit de5bd91055
3 changed files with 37 additions and 6 deletions

View File

@@ -238,11 +238,9 @@ class Selection
adjustIndentationForLine: (line, delta) ->
currentIndentLevel = @editSession.indentLevelForLine(line)
currentIndentString = @editSession.buildIndentString(currentIndentLevel)
desiredIndentLevel = Math.max(0, currentIndentLevel + delta)
desiredIndentString = @editSession.buildIndentString(desiredIndentLevel)
line.replace(new RegExp("^#{currentIndentString}"), desiredIndentString)
line.replace(/^[\t ]*/, desiredIndentString)
backspace: ->
if @isEmpty() and not @editSession.isFoldedAtScreenRow(@cursor.getScreenRow())