1 utils = require 'utils'
3 commands = require 'commands'
15 constructor: (@window) ->
23 Object.defineProperty(this, 'findStr',
24 get: -> return Vim.findStr
25 set: (value) -> Vim.findStr = value
28 enterHintsMode: (@markers, @cb) ->
31 # TODO: This function should probably remove
32 # hint markers (if they are present) as well
35 @markers = @cb = undefined
37 handleKeyDown: (keyboardEvent, keyStr) ->
38 if @mode == MODE_NORMAL || keyStr == 'Esc'
39 result = commands.maybeCommand(@keys.concat([keyStr]))
40 else if !keyboardEvent.ctrlKey and !keyboardEvent.metaKey
41 if @mode == MODE_HINTS
42 result = utils.getHintChars().search(utils.regexpEscape(keyStr)) > -1
50 handleKeyPress: (keyboardEvent) ->
51 lastKeyStr = if @keys.length > 0 then @keys[@keys.length - 1] else undefined
52 if @mode == MODE_NORMAL or lastKeyStr == 'Esc'
53 if command = commands.findCommand(@keys)
57 else if !keyboardEvent.ctrlKey and !keyboardEvent.metaKey
59 if @mode == MODE_HINTS
60 commands.hintCharHandler(@, lastKeyStr, keyboardEvent.charCode)