Support outdenting when indent is < 1 tab length

This commit is contained in:
Kevin Sawicki
2012-10-23 09:57:30 -07:00
parent 518d88a4ab
commit ab8c22825c
3 changed files with 25 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ class EditSession
setSoftWrap: (@softWrap) ->
getTabText: -> new Array(@tabLength + 1).join(" ")
getTabLength: -> @tabLength
clipBufferPosition: (bufferPosition) ->
@buffer.clipPosition(bufferPosition)

View File

@@ -213,10 +213,10 @@ class Selection
outdentSelectedRows: ->
range = @getBufferRange()
buffer = @editSession.buffer
leadingTabRegex = new RegExp("^#{@editSession.getTabText()}")
leadingTabRegex = new RegExp("^ {1,#{@editSession.getTabLength()}}|\t")
for row in [range.start.row..range.end.row]
if leadingTabRegex.test buffer.lineForRow(row)
buffer.delete [[row, 0], [row, @editSession.tabLength]]
if matchLength = buffer.lineForRow(row).match(leadingTabRegex)?[0].length
buffer.delete [[row, 0], [row, matchLength]]
toggleLineComments: ->
@modifySelection =>