 class VisualBlockwise extends Base
   @extend()
   complete: true
+
+  initialize: ->
+    # PlantTail
+    unless @getTail()?
+      @updateProperties {head: @getBottom(), tail: @getTop()}
 
   eachSelection: (fn) ->
     for s in @editor.getSelections()


class BlockwiseRestoreCharacterwise extends VisualBlockwise
  @extend()
  execute: ->
    reversed = @isReversed()
    head = @getHead()
    headIsReversed = head.isReversed()
    startRow = @getTop().getBufferRowRange().shift()
    endRow = @getBottom().getBufferRowRange().shift()
    {start: {column: startColumn}, end: {column: endColumn}} = head.getBufferRange()
    if reversed isnt headIsReversed
      [startColumn, endColumn] = [endColumn, startColumn]
    range = new Range([startRow, startColumn], [endRow, endColumn])
    {start, end} = range
    range = range.translate([0, -1], [0, +1]) if start.column >= end.column
    @editor.setSelectedBufferRange(range, {reversed})

module.exports = {

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

    if startColumn >= endColumn
