1 {ViewModel, Input} = require './view-model'
4 class ExViewModel extends ViewModel
5 constructor: (@exCommand) ->
6 super(@exCommand, class: 'command')
9 atom.commands.add(@view.editorElement, 'core:move-up', @increaseHistoryEx)
10 atom.commands.add(@view.editorElement, 'core:move-down', @decreaseHistoryEx)
12 restoreHistory: (index) ->
13 @view.editorElement.getModel().setText(@history(index).value)
16 @exState.getExHistoryItem(index)
19 if @history(@historyIndex + 1)?
21 @restoreHistory(@historyIndex)
25 # get us back to a clean slate
27 @view.editorElement.getModel().setText('')
30 @restoreHistory(@historyIndex)
34 @exState.pushExHistory(@)