1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-07 21:34:09 +02:00

Fix problem with unsatisfied condition

This commit is contained in:
Alex Plate 2024-07-29 16:15:58 +02:00
parent bfb1d5b7f5
commit 1e0fa07768
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -13,6 +13,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.testFramework.PlatformTestUtil
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.key
import com.maddyhome.idea.vim.key.CommandNode
import com.maddyhome.idea.vim.newapi.vim
import org.jetbrains.jetCheck.Generator
@ -93,7 +94,8 @@ private class AvailableActions(private val editor: Editor) : ImperativeCommand {
override fun performCommand(env: ImperativeCommand.Environment) {
val currentNode = KeyHandler.getInstance().keyHandlerState.commandBuilder.getCurrentTrie()
val possibleKeys = currentNode.keys.toList().sortedBy { injector.parser.toKeyNotation(it) }
// Note: esc is always an option
val possibleKeys = (currentNode.keys.toList() + esc).sortedBy { injector.parser.toKeyNotation(it) }
println("Keys: ${possibleKeys.joinToString(", ")}")
val keyGenerator = Generator.integers(0, possibleKeys.lastIndex)
.suchThat { injector.parser.toKeyNotation(possibleKeys[it]) !in stinkyKeysList }
@ -108,6 +110,8 @@ private class AvailableActions(private val editor: Editor) : ImperativeCommand {
IdeEventQueue.getInstance().flushQueue()
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
}
private val esc = key("<Esc>")
}
private val stinkyKeysList = arrayListOf(