 class Indentation extends Paragraph
   @extend(false)
 
-  getRange: (startRow) ->
-    return if @editor.isBufferRowBlank(startRow)
+  getRange: (selection) ->
+    startRow = selection.getBufferRange().start.row
     baseIndentLevel = getIndentLevelForBufferRow(@editor, startRow)
     fn = (row) =>
       if @editor.isBufferRowBlank(row)

    [startRow, endRow] = selection.getBufferRowRange()

    if firstTime and not @isMode('visual', 'linewise')
      swrap(selection).setBufferRangeSafely @getRange(startRow)
    else
      point = if selection.isReversed()
        @getRange(startRow - 1)?.start
      else
        @getRange(endRow + 1)?.end
      selection.selectToBufferPosition point if point?

  selectTextObject: (selection) ->

  getFoldRowRangesContainsForRow: (row) ->
    getCodeFoldRowRangesContainesForRow(@editor, row, true)?.reverse()

  getRange: (selection) ->
    range = selection.getBufferRange()
    rowRanges = @getFoldRowRangesContainsForRow(range.start.row)
    return unless rowRanges.length

    if (rowRange = rowRanges.shift())?
      rowRange = @adjustRowRange(rowRange)
      targetRange = getBufferRangeForRowRange(@editor, rowRange)
      if targetRange.isEqual(range) and rowRanges.length
        rowRange = @adjustRowRange(rowRanges.shift())

    getBufferRangeForRowRange(@editor, rowRange)

  selectTextObject: (selection) ->
    swrap(selection).setBufferRangeSafely(@getRange(selection))

class AFold extends Fold
  @extend()
