1 utils = require 'utils'
2 hints = require 'hints'
5 enter: (vim, storage, [ callback ]) ->
6 markers = hints.injectHints(vim.window.document)
10 storage.markers = markers
11 storage.callback = callback
13 handleKeyDown: (vim, storage, event, keyStr) ->
14 if utils.getHintChars().search(utils.regexpEscape(keyStr)) > -1
15 @hintCharHandler(vim, storage, keyStr)
18 onEnterNormalMode: (vim, storage) ->
19 hints.removeHints(vim.window.document)
20 storage.markers = storage.callback = undefined
22 # Processes the char, updates and hides/shows markers
23 hintCharHandler: (vim, storage, keyStr) ->
25 # Get char and escape it to avoid problems with String.search
26 key = utils.regexpEscape(keyStr)
28 { markers, callback } = storage
30 # First do a pre match - count how many markers will match with the new character entered
31 if markers.reduce(((v, marker) -> v or marker.willMatch(key)), false)
33 marker.matchHintChar(key)
36 # Add element features to the bloom filter