aboutsummaryrefslogtreecommitdiff
path: root/atom/packages/vim-mode/lib/view-models/view-model.coffee
blob: 9cc63e163b835cf7b289d697144db92679fbe9b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
VimCommandModeInputElement = require './vim-command-mode-input-element'

class ViewModel
  constructor: (@operation, opts={}) ->
    {@editor, @vimState} = @operation
    @view = new VimCommandModeInputElement().initialize(this, opts)
    @editor.commandModeInputView = @view
    @vimState.onDidFailToCompose => @view.remove()

  confirm: (view) ->
    @vimState.pushOperations(new Input(@view.value))

  cancel: (view) ->
    if @vimState.isOperatorPending()
      @vimState.pushOperations(new Input(''))

class Input
  constructor: (@characters) ->
  isComplete: -> true
  isRecordable: -> true

module.exports = {
  ViewModel, Input
}