diff options
| author | Ben Beltran <ben@nsovocal.com> | 2019-03-14 23:19:58 +0100 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2019-03-14 23:19:58 +0100 |
| commit | b009b50e81b6c1d0d691505b5f5c0418f559bfc0 (patch) | |
| tree | 5fae800e76219eba28634cb236565f9b4bb7a2f7 /atom/packages/vim-mode/lib/motions/find-motion.coffee | |
| parent | 4efcafab7f0aa454f9ebe767133654bc9f44e12c (diff) | |
Remove Atom config
Diffstat (limited to 'atom/packages/vim-mode/lib/motions/find-motion.coffee')
| -rw-r--r-- | atom/packages/vim-mode/lib/motions/find-motion.coffee | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/atom/packages/vim-mode/lib/motions/find-motion.coffee b/atom/packages/vim-mode/lib/motions/find-motion.coffee deleted file mode 100644 index 2a577a8..0000000 --- a/atom/packages/vim-mode/lib/motions/find-motion.coffee +++ /dev/null @@ -1,72 +0,0 @@ -{MotionWithInput} = require './general-motions' -{ViewModel} = require '../view-models/view-model' -{Point, Range} = require 'atom' - -class Find extends MotionWithInput - operatesInclusively: true - - constructor: (@editor, @vimState, opts={}) -> - super(@editor, @vimState) - @offset = 0 - - if not opts.repeated - @viewModel = new ViewModel(this, class: 'find', singleChar: true, hidden: true) - @backwards = false - @repeated = false - @vimState.globalVimState.currentFind = this - - else - @repeated = true - - orig = @vimState.globalVimState.currentFind - @backwards = orig.backwards - @complete = orig.complete - @input = orig.input - - @reverse() if opts.reverse - - match: (cursor, count) -> - currentPosition = cursor.getBufferPosition() - line = @editor.lineTextForBufferRow(currentPosition.row) - if @backwards - index = currentPosition.column - for i in [0..count-1] - return if index <= 0 # we can't move backwards any further, quick return - index = line.lastIndexOf(@input.characters, index-1-(@offset*@repeated)) - if index >= 0 - new Point(currentPosition.row, index + @offset) - else - index = currentPosition.column - for i in [0..count-1] - index = line.indexOf(@input.characters, index+1+(@offset*@repeated)) - return if index < 0 # no match found - if index >= 0 - new Point(currentPosition.row, index - @offset) - - reverse: -> - @backwards = not @backwards - this - - moveCursor: (cursor, count=1) -> - if (match = @match(cursor, count))? - cursor.setBufferPosition(match) - -class Till extends Find - constructor: (@editor, @vimState, opts={}) -> - super(@editor, @vimState, opts) - @offset = 1 - - match: -> - @selectAtLeastOne = false - retval = super - if retval? and not @backwards - @selectAtLeastOne = true - retval - - moveSelectionInclusively: (selection, count, options) -> - super - if selection.isEmpty() and @selectAtLeastOne - selection.modifySelection -> - selection.cursor.moveRight() - -module.exports = {Find, Till} |