   isBackwards: ->
     @backwards
 
+  getInput: ->
+    @input
+
   # Not sure if I should support count but keep this for compatibility to official vim-mode.
   getCount: ->
     count = super

  @extend()
  wordRegex: null

  initialize: ->
    super
    # FIXME: This must depend on the current language
    defaultIsKeyword = "[@a-zA-Z0-9_\-]+"
    userIsKeyword = atom.config.get('vim-mode.iskeyword')
    @wordRegex = new RegExp(userIsKeyword or defaultIsKeyword)
    unless @input = @getCurrentWord()
      @abort()

  getPattern: (text) ->
    pattern = _.escapeRegExp(text)


  scan: (cursor) ->
    ranges = []

    # FIXME: ORDER MATTER
    # In SearchCurrentWord, @getInput move cursor, which is necessary movement.
    # So we need to call @getInput() BEFORE settin fromPoint
    input = @getInput()
    return ranges if input is ''

    fromPoint = if @isMode('visual', 'linewise') and @isIncrementalSearch()
      swrap(cursor.selection).getCharacterwiseHeadPosition()
    else
      cursor.getBufferPosition()

    @editor.scan @getPattern(input), ({range}) ->
      ranges.push range

    [pre, post] = _.partition ranges, ({start}) =>
      if @isBackwards()
        start.isLessThan(fromPoint)
      else
        start.isLessThanOrEqual(fromPoint)

    post.concat(pre)

