Hard tabs in snippets are translated to soft-tabs if necessary

This commit is contained in:
Corey Johnson & Nathan Sobo
2013-01-28 16:04:08 -07:00
parent 7e494caaff
commit c13b45df99
4 changed files with 34 additions and 6 deletions

View File

@@ -211,6 +211,10 @@ class EditSession
autoIndentSelectedRows: ->
@mutateSelectedText (selection) -> selection.autoIndentSelectedRows()
normalizeTabsInBufferRange: (bufferRange) ->
return unless @softTabs
@scanInRange /\t/, bufferRange, (match, range, {replace}) => replace(@getTabText())
cutToEndOfLine: ->
maintainPasteboard = false
@mutateSelectedText (selection) ->
@@ -251,8 +255,9 @@ class EditSession
undo: (editSession) ->
editSession?.setSelectedBufferRanges(oldSelectedRanges)
if fn
fn()
result = fn()
@commit() if isNewTransaction
result
commit: ->
newSelectedRanges = @getSelectedBufferRanges()

View File

@@ -185,6 +185,8 @@ class Selection
else
@editSession.autoDecreaseIndentForRow(newBufferRange.start.row)
newBufferRange
indent: ({ autoIndent }={})->
{ row, column } = @cursor.getBufferPosition()