]>
Commit | Line | Data |
---|---|---|
455f099b | 1 | ExNormalModeInputElement = require './ex-normal-mode-input-element' |
24c7594d BB |
2 | |
3 | class ViewModel | |
4 | constructor: (@command, opts={}) -> | |
5 | {@editor, @exState} = @command | |
6 | ||
455f099b BB |
7 | @view = new ExNormalModeInputElement().initialize(@, opts) |
8 | @editor.normalModeInputView = @view | |
24c7594d BB |
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 | } |