mirror of
https://github.com/chylex/IntelliJ-Keyboard-Master.git
synced 2024-11-25 01:42:47 +01:00
Compare commits
No commits in common. "d76e259c255d3a2eb84db811411b1a2ad9c284ff" and "48a9159c871dff67c0910880129caa2f67fd000e" have entirely different histories.
d76e259c25
...
48a9159c87
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.chylex.intellij.keyboardmaster"
|
group = "com.chylex.intellij.keyboardmaster"
|
||||||
version = "0.5.6"
|
version = "0.5.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -10,7 +10,6 @@ import com.intellij.openapi.actionSystem.KeyboardShortcut
|
|||||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.project.DumbAwareAction
|
import com.intellij.openapi.project.DumbAwareAction
|
||||||
import com.intellij.openapi.util.SystemInfo
|
|
||||||
import com.intellij.toolWindow.InternalDecoratorImpl
|
import com.intellij.toolWindow.InternalDecoratorImpl
|
||||||
import com.intellij.ui.SpeedSearchBase
|
import com.intellij.ui.SpeedSearchBase
|
||||||
import com.intellij.ui.speedSearch.SpeedSearch
|
import com.intellij.ui.speedSearch.SpeedSearch
|
||||||
@ -33,9 +32,6 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
protected val ENTER_KEY: KeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)
|
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 {
|
private fun findOriginalEnterAction(component: JComponent): WrappedAction {
|
||||||
var originalEnterAction: WrappedAction? = null
|
var originalEnterAction: WrappedAction? = null
|
||||||
|
|
||||||
@ -78,7 +74,7 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun getAllKeyStrokes(): Set<KeyStroke> {
|
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) {
|
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) {
|
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) {
|
protected inline fun handleEnterKeyPress(originalAction: () -> Unit) {
|
||||||
if (isSearching.compareAndSet(true, false) && !runEnterActionImmediately(keyEvent)) {
|
if (isSearching.compareAndSet(true, false)) {
|
||||||
stopSpeedSearch()
|
stopSpeedSearch()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentNode = rootNode
|
currentNode = rootNode
|
||||||
originalAction(keyEvent)
|
originalAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun runEnterActionImmediately(keyEvent: KeyEvent): Boolean {
|
|
||||||
return if (SystemInfo.isMac) keyEvent.isMetaDown else keyEvent.isControlDown
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun stopSpeedSearch() {
|
protected open fun stopSpeedSearch() {
|
||||||
when (val supply = SpeedSearchSupply.getSupply(component)) {
|
when (val supply = SpeedSearchSupply.getSupply(component)) {
|
||||||
is SpeedSearchBase<*> -> supply.hidePopup()
|
is SpeedSearchBase<*> -> supply.hidePopup()
|
||||||
|
@ -90,7 +90,7 @@ internal object VimListNavigation {
|
|||||||
if (popup is ListPopupImpl) {
|
if (popup is ListPopupImpl) {
|
||||||
popup.registerAction("KeyboardMaster-VimListNavigation-Enter", ENTER_KEY, object : AbstractAction() {
|
popup.registerAction("KeyboardMaster-VimListNavigation-Enter", ENTER_KEY, object : AbstractAction() {
|
||||||
override fun actionPerformed(e: ActionEvent) {
|
override fun actionPerformed(e: ActionEvent) {
|
||||||
handleEnterKeyPress(createEnterEvent(e)) { popup.handleSelect(true, it) }
|
handleEnterKeyPress { popup.handleSelect(true, createEnterEvent(e)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createEnterEvent(e: ActionEvent): KeyEvent {
|
private fun createEnterEvent(e: ActionEvent): KeyEvent {
|
||||||
|
Loading…
Reference in New Issue
Block a user