]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/lib/view-model.coffee
Update vim plugins
[rbdr/dotfiles] / atom / packages / ex-mode / lib / view-model.coffee
1 ExNormalModeInputElement = require './ex-normal-mode-input-element'
2
3 class ViewModel
4 constructor: (@command, opts={}) ->
5 {@editor, @exState} = @command
6
7 @view = new ExNormalModeInputElement().initialize(@, opts)
8 @editor.normalModeInputView = @view
9 @exState.onDidFailToExecute => @view.remove()
10 @done = false
11
12 confirm: (view) ->
13 @exState.pushOperations(new Input(@view.value))
14 @done = true
15
16 cancel: (view) ->
17 unless @done
18 @exState.pushOperations(new Input(''))
19 @done = true
20
21 class Input
22 constructor: (@characters) ->
23
24 module.exports = {
25 ViewModel, Input
26 }