   @extend()
   select: ->
     @editor.selectAll()
-    @editor.getLastSelection().isEmpty()
+    @isIncludeNonEmptySelection()
 
 module.exports = {
   Word, WholeWord,

  selectParagraph: (selection) ->
    [startRow, endRow] = selection.getBufferRowRange()
    if startRow is endRow
      if range = @getRange(startRow)
        selection.setBufferRange(range)
    else # have direction
      if selection.isReversed()
        if range = @getRange(startRow-1)

    new Range(point, Point.INFINITY)

  isLinewise: ->
    @editor.getSelections().every (s) =>
      @isLinewiseRange s.getBufferRange()

  eachSelection: (callback) ->
    for s in @editor.getSelections()
      callback s
    if @isLinewise() and not @vimState.isMode('visual', 'linewise')
      @vimState.activate('visual', 'linewise')
    @isIncludeNonEmptySelection()

  isIncludeNonEmptySelection: ->
    @editor.getSelections().some((s) -> not s.isEmpty())

  sortRanges: (ranges) ->
    ranges.sort((a, b) -> a.compare(b))

  setBufferRangeSafely: (selection, range) ->
    if range
      selection.setBufferRange(range)

# Word
# -------------------------
