mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-17 14:46:03 +01:00
Fix(VIM-3615): Escape closes dialog while waiting for more keys
This commit is contained in:
parent
0f7116b136
commit
fdd850de5a
src/main/java/com/maddyhome/idea/vim/handler
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command
@ -218,13 +218,17 @@ internal class VimEnterHandler(nextHandler: EditorActionHandler?) : VimKeyHandle
|
||||
internal class VimEscHandler(nextHandler: EditorActionHandler) : VimKeyHandler(nextHandler) {
|
||||
override val key: String = "<Esc>"
|
||||
|
||||
private val ideaVimSupportDialog
|
||||
get() = injector.globalIjOptions().ideavimsupport.contains(IjOptionConstants.ideavimsupport_dialog)
|
||||
|
||||
override fun isHandlerEnabled(editor: Editor, dataContext: DataContext?): Boolean {
|
||||
val ideaVimSupportDialog =
|
||||
injector.globalIjOptions().ideavimsupport.contains(IjOptionConstants.ideavimsupport_dialog)
|
||||
|
||||
return editor.isPrimaryEditor() ||
|
||||
EditorHelper.isFileEditor(editor) && !editor.vim.mode.inNormalMode ||
|
||||
ideaVimSupportDialog && !editor.vim.mode.inNormalMode
|
||||
EditorHelper.isFileEditor(editor) && vimStateNeedsToHandleEscape(editor) ||
|
||||
ideaVimSupportDialog && vimStateNeedsToHandleEscape(editor)
|
||||
}
|
||||
|
||||
private fun vimStateNeedsToHandleEscape(editor: Editor): Boolean {
|
||||
return !editor.vim.mode.inNormalMode || KeyHandler.getInstance().keyHandlerState.mappingState.hasKeys
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,9 @@ class MappingState: Cloneable {
|
||||
|
||||
val keys: Iterable<KeyStroke>
|
||||
get() = keyList
|
||||
|
||||
val hasKeys
|
||||
get() = keyList.isNotEmpty()
|
||||
|
||||
private var timer = VimTimer(injector.globalOptions().timeoutlen)
|
||||
private var keyList = mutableListOf<KeyStroke>()
|
||||
|
Loading…
Reference in New Issue
Block a user