1
0
mirror of https://github.com/chylex/IntelliJ-Keyboard-Master.git synced 2024-10-17 07:42:48 +02:00

Compare commits

..

No commits in common. "d76e259c255d3a2eb84db811411b1a2ad9c284ff" and "48a9159c871dff67c0910880129caa2f67fd000e" have entirely different histories.

3 changed files with 7 additions and 15 deletions

View File

@ -8,7 +8,7 @@ plugins {
}
group = "com.chylex.intellij.keyboardmaster"
version = "0.5.6"
version = "0.5.5"
repositories {
mavenCentral()

View File

@ -10,7 +10,6 @@ import com.intellij.openapi.actionSystem.KeyboardShortcut
import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.util.SystemInfo
import com.intellij.toolWindow.InternalDecoratorImpl
import com.intellij.ui.SpeedSearchBase
import com.intellij.ui.speedSearch.SpeedSearch
@ -33,9 +32,6 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
@JvmStatic
protected val ENTER_KEY: KeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)
private val CTRL_ENTER_KEY: KeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_DOWN_MASK)
private val META_ENTER_KEY: KeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.META_DOWN_MASK)
private fun findOriginalEnterAction(component: JComponent): WrappedAction {
var originalEnterAction: WrappedAction? = null
@ -78,7 +74,7 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
}
protected fun getAllKeyStrokes(): Set<KeyStroke> {
return KeyStrokeNode.getAllKeyStrokes(rootNode, setOf(ENTER_KEY, CTRL_ENTER_KEY, META_ENTER_KEY))
return KeyStrokeNode.getAllKeyStrokes(rootNode, setOf(ENTER_KEY))
}
private fun handleSpeedSearchChange(e: PropertyChangeEvent) {
@ -112,23 +108,19 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
}
private fun handleEnterKeyPress(actionEvent: AnActionEvent, keyEvent: KeyEvent) {
handleEnterKeyPress(keyEvent) { originalEnterAction.perform(actionEvent, it) }
handleEnterKeyPress { originalEnterAction.perform(actionEvent, keyEvent) }
}
protected inline fun handleEnterKeyPress(keyEvent: KeyEvent, originalAction: (KeyEvent) -> Unit) {
if (isSearching.compareAndSet(true, false) && !runEnterActionImmediately(keyEvent)) {
protected inline fun handleEnterKeyPress(originalAction: () -> Unit) {
if (isSearching.compareAndSet(true, false)) {
stopSpeedSearch()
}
else {
currentNode = rootNode
originalAction(keyEvent)
originalAction()
}
}
private fun runEnterActionImmediately(keyEvent: KeyEvent): Boolean {
return if (SystemInfo.isMac) keyEvent.isMetaDown else keyEvent.isControlDown
}
protected open fun stopSpeedSearch() {
when (val supply = SpeedSearchSupply.getSupply(component)) {
is SpeedSearchBase<*> -> supply.hidePopup()

View File

@ -90,7 +90,7 @@ internal object VimListNavigation {
if (popup is ListPopupImpl) {
popup.registerAction("KeyboardMaster-VimListNavigation-Enter", ENTER_KEY, object : AbstractAction() {
override fun actionPerformed(e: ActionEvent) {
handleEnterKeyPress(createEnterEvent(e)) { popup.handleSelect(true, it) }
handleEnterKeyPress { popup.handleSelect(true, createEnterEvent(e)) }
}
private fun createEnterEvent(e: ActionEvent): KeyEvent {