diff options
Diffstat (limited to 'atom/packages/vim-mode/lib/view-models/view-model.coffee')
| -rw-r--r-- | atom/packages/vim-mode/lib/view-models/view-model.coffee | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/atom/packages/vim-mode/lib/view-models/view-model.coffee b/atom/packages/vim-mode/lib/view-models/view-model.coffee new file mode 100644 index 0000000..9cc63e1 --- /dev/null +++ b/atom/packages/vim-mode/lib/view-models/view-model.coffee @@ -0,0 +1,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 +} |