mirror of
https://github.com/chylex/IntelliJ-Keyboard-Master.git
synced 2024-11-25 01:42:47 +01:00
Compare commits
3 Commits
401d5101e7
...
cd69968868
Author | SHA1 | Date | |
---|---|---|---|
cd69968868 | |||
be41677c59 | |||
b1d5c57e04 |
@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.chylex.intellij.keyboardmaster"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -17,6 +17,7 @@ import java.awt.Container
|
||||
import java.awt.event.ActionEvent
|
||||
import java.awt.event.ActionListener
|
||||
import java.awt.event.KeyEvent
|
||||
import java.beans.PropertyChangeEvent
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.KeyStroke
|
||||
@ -60,20 +61,26 @@ internal open class VimNavigationDispatcher<T : JComponent>(final override val c
|
||||
|
||||
init {
|
||||
registerCustomShortcutSet(KeyStrokeNode.getAllShortcuts(getAllKeyStrokes()), component, DISPOSABLE)
|
||||
|
||||
val speedSearch = SpeedSearchSupply.getSupply(component, true)
|
||||
speedSearch?.addChangeListener {
|
||||
if (it.propertyName == SpeedSearchSupply.ENTERED_PREFIX_PROPERTY_NAME && !speedSearch.isPopupActive) {
|
||||
isSearching.set(false)
|
||||
currentNode = rootNode
|
||||
}
|
||||
}
|
||||
SpeedSearchSupply.getSupply(component, true)?.addChangeListener(::handleSpeedSearchChange)
|
||||
}
|
||||
|
||||
protected fun getAllKeyStrokes(): Set<KeyStroke> {
|
||||
return KeyStrokeNode.getAllKeyStrokes(rootNode, setOf(ENTER_KEY))
|
||||
}
|
||||
|
||||
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)
|
||||
currentNode = rootNode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final override fun actionPerformed(e: AnActionEvent) {
|
||||
val keyEvent = e.inputEvent as? KeyEvent ?: return
|
||||
|
||||
|
@ -85,7 +85,7 @@ internal object VimTreeNavigation {
|
||||
val parentPath = path.parentPath ?: return
|
||||
val parentRow = tree.getRowForPath(parentPath)
|
||||
|
||||
tree.setSelectionRow(parentRow + 1)
|
||||
selectRow(tree, parentRow + 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,12 @@ internal object VimTreeNavigation {
|
||||
}
|
||||
}
|
||||
|
||||
tree.setSelectionRow(targetRow)
|
||||
selectRow(tree, targetRow)
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectRow(tree: JTree, row: Int) {
|
||||
tree.setSelectionRow(row)
|
||||
tree.scrollRowToVisible(row)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user