1 utils = require 'utils'
2 { mode_hints } = require 'mode-hints/mode-hints'
3 { updateToolbarButton } = require 'button'
4 { searchForMatchingCommand
5 , isEscCommandKey } = require 'commands'
10 onEnter: (vim, storage, args) ->
12 storage.commands ?= {}
14 onLeave: (vim, storage, args) ->
15 storage.keys.length = 0
17 onInput: (vim, storage, keyStr, event) ->
18 storage.keys.push(keyStr)
20 { match, exact, command } = searchForMatchingCommand(storage.keys)
24 commandStorage = storage.commands[command.name] ?= {}
25 command.func(vim, commandStorage, event)
26 storage.keys.length = 0
29 storage.keys.length = 0
33 return unless rootWindow = utils.getRootWindow(vim.window)
34 updateToolbarButton(rootWindow, {insertMode: true})
36 return unless rootWindow = utils.getRootWindow(vim.window)
37 updateToolbarButton(rootWindow, {insertMode: false})
38 utils.blurActiveElement(vim.window)
39 onInput: (vim, storage, keyStr) ->
40 if isEscCommandKey(keyStr)
41 vim.enterMode('normal')
44 modes['hints'] = mode_hints