   execute: ->
     selection = @editor.getLastSelection()
     wasReversed = reversed = selection.isReversed()
-    [startRow, endRow] = selection.getBufferRowRange()
     {start: {column: startColumn}, end: {column: endColumn}} = selection.getBufferRange()
 
     if startColumn >= endColumn

      startColumn += 1
      endColumn -= 1

    ranges = ([[row, startColumn], [row, endColumn]] for row in [startRow..endRow])
    @editor.setSelectedBufferRanges(ranges, {reversed})
    if wasReversed


class BlockwiseRestoreCharacterwise extends VisualBlockwise
  @extend()

  execute: ->
    reversed = @isReversed()
    head = @getHead()
    headIsReversed = head.isReversed()
    [startRow, endRow] = @getBufferRowRange()
    {start: {column: startColumn}, end: {column: endColumn}} = head.getBufferRange()
    if reversed isnt headIsReversed
      [startColumn, endColumn] = [endColumn, startColumn]
      startColumn -= 1
      endColumn += 1
    range = [[startRow, startColumn], [endRow, endColumn]]
    @editor.setSelectedBufferRange(range, {reversed})

module.exports = {
