 # -------------------------
 class Word extends TextObject
   @extend(false)
+  allowEmpty: true
 
   getPattern: (selection) ->
     point = swrap(selection).getNormalizedBufferPosition()
-    if pointIsSurroundedByWhitespace(@editor, point)
+    if pointIsSurroundedByWhitespace(@editor, point) and @allowEmpty
       /[\t ]*/
     else
       @wordRegExp ? getWordRegExpForPointWithCursor(selection.cursor, point)


  getRange: (selection) ->
    pattern = @getPattern(selection)
    from = swrap(selection).getNormalizedBufferPosition()
    options = containedOnly: true
    start = getStartPositionForPattern(@editor, from, pattern, options)

class AFunctionOrInnerParagraph extends UnionTextObject
  @extend()
  member: ['AFunction', 'InnerParagraph']

class SomeTextObject extends TextObject
  @extend(false)
  member: []
  memberOptoins: {}

  getRangeBy: (klass, selection) ->
    @new(klass, @memberOptoins).getRange(selection)

  getRanges: (selection) ->
    (range for klass in @member when (range = @getRangeBy(klass, selection)))

  getNearestRange: (selection) ->
    ranges = @getRanges(selection)
    _.last(sortRanges(ranges)) if ranges.length

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

class InnerNonEmptySmartWordOrInnerParenthesis extends SomeTextObject
  @extend()
  member: [
    "InnerNonEmptySmartWord"
    "InnerParenthesis"
  ]
