]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/lib/view-models/view-model.coffee
9cc63e163b835cf7b289d697144db92679fbe9b1
[rbdr/dotfiles] / atom / packages / vim-mode / lib / view-models / view-model.coffee
1 VimCommandModeInputElement = require './vim-command-mode-input-element'
2
3 class ViewModel
4 constructor: (@operation, opts={}) ->
5 {@editor, @vimState} = @operation
6 @view = new VimCommandModeInputElement().initialize(this, opts)
7 @editor.commandModeInputView = @view
8 @vimState.onDidFailToCompose => @view.remove()
9
10 confirm: (view) ->
11 @vimState.pushOperations(new Input(@view.value))
12
13 cancel: (view) ->
14 if @vimState.isOperatorPending()
15 @vimState.pushOperations(new Input(''))
16
17 class Input
18 constructor: (@characters) ->
19 isComplete: -> true
20 isRecordable: -> true
21
22 module.exports = {
23 ViewModel, Input
24 }