mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Support outdenting when indent is < 1 tab length
This commit is contained in:
@@ -108,6 +108,7 @@ class EditSession
|
||||
setSoftWrap: (@softWrap) ->
|
||||
|
||||
getTabText: -> new Array(@tabLength + 1).join(" ")
|
||||
getTabLength: -> @tabLength
|
||||
|
||||
clipBufferPosition: (bufferPosition) ->
|
||||
@buffer.clipPosition(bufferPosition)
|
||||
|
||||
@@ -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 =>
|
||||
|
||||
Reference in New Issue
Block a user