]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/lib/view-models/view-model.coffee
Update atoms
[rbdr/dotfiles] / atom / packages / vim-mode / lib / view-models / view-model.coffee
1 VimNormalModeInputElement = require './vim-normal-mode-input-element'
2
3 class ViewModel
4 constructor: (@operation, opts={}) ->
5 {@editor, @vimState} = @operation
6 @view = new VimNormalModeInputElement().initialize(this, atom.views.getView(@editor), opts)
7 @editor.normalModeInputView = @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 delete @editor.normalModeInputView
17
18 class Input
19 constructor: (@characters) ->
20 isComplete: -> true
21 isRecordable: -> true
22
23 module.exports = {
24 ViewModel, Input
25 }