1
0
mirror of https://github.com/chylex/IntelliJ-Keyboard-Master.git synced 2024-11-25 10:42:46 +01:00

Compare commits

..

No commits in common. "cd69968868c2fbb9775f359b19878162039eae85" and "401d5101e787075957c3b720a33f32ad664a40fb" have entirely different histories.

3 changed files with 11 additions and 23 deletions

View File

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

View File

@ -17,7 +17,6 @@ import java.awt.Container
import java.awt.event.ActionEvent import java.awt.event.ActionEvent
import java.awt.event.ActionListener import java.awt.event.ActionListener
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.beans.PropertyChangeEvent
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
import javax.swing.JComponent import javax.swing.JComponent
import javax.swing.KeyStroke import javax.swing.KeyStroke
@ -61,24 +60,18 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
init { init {
registerCustomShortcutSet(KeyStrokeNode.getAllShortcuts(getAllKeyStrokes()), component, DISPOSABLE) registerCustomShortcutSet(KeyStrokeNode.getAllShortcuts(getAllKeyStrokes()), component, DISPOSABLE)
SpeedSearchSupply.getSupply(component, true)?.addChangeListener(::handleSpeedSearchChange)
}
protected fun getAllKeyStrokes(): Set<KeyStroke> { val speedSearch = SpeedSearchSupply.getSupply(component, true)
return KeyStrokeNode.getAllKeyStrokes(rootNode, setOf(ENTER_KEY)) speedSearch?.addChangeListener {
} if (it.propertyName == SpeedSearchSupply.ENTERED_PREFIX_PROPERTY_NAME && !speedSearch.isPopupActive) {
private fun handleSpeedSearchChange(e: PropertyChangeEvent) {
if (e.propertyName == SpeedSearchSupply.ENTERED_PREFIX_PROPERTY_NAME) {
val speedSearch = e.source as? SpeedSearchSupply ?: return
ApplicationManager.getApplication().invokeLater {
if (!speedSearch.isPopupActive) {
isSearching.set(false) isSearching.set(false)
currentNode = rootNode currentNode = rootNode
} }
} }
} }
protected fun getAllKeyStrokes(): Set<KeyStroke> {
return KeyStrokeNode.getAllKeyStrokes(rootNode, setOf(ENTER_KEY))
} }
final override fun actionPerformed(e: AnActionEvent) { final override fun actionPerformed(e: AnActionEvent) {

View File

@ -85,7 +85,7 @@ internal object VimTreeNavigation {
val parentPath = path.parentPath ?: return val parentPath = path.parentPath ?: return
val parentRow = tree.getRowForPath(parentPath) val parentRow = tree.getRowForPath(parentPath)
selectRow(tree, parentRow + 1) tree.setSelectionRow(parentRow + 1)
} }
} }
@ -111,12 +111,7 @@ internal object VimTreeNavigation {
} }
} }
selectRow(tree, targetRow) tree.setSelectionRow(targetRow)
} }
} }
private fun selectRow(tree: JTree, row: Int) {
tree.setSelectionRow(row)
tree.scrollRowToVisible(row)
}
} }