mirror of
https://github.com/chylex/IntelliJ-Keyboard-Master.git
synced 2025-04-24 05:15:42 +02:00
Disable automatic tree auto-expansion in vim-style navigation
This commit is contained in:
parent
f814ec04bd
commit
5aea7947ec
@ -59,7 +59,7 @@ internal object VimTreeNavigation {
|
||||
tree.collapsePath(path)
|
||||
}
|
||||
else {
|
||||
tree.expandPath(path)
|
||||
runWithoutAutoExpand(tree) { tree.expandPath(path) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,16 +116,6 @@ internal object VimTreeNavigation {
|
||||
pathsToExpand = nextPathsToExpand
|
||||
} while (pathsToExpand.isNotEmpty())
|
||||
}
|
||||
|
||||
private inline fun runWithoutAutoExpand(tree: JTree, action: () -> Unit) {
|
||||
val previousAutoExpandValue = ClientProperty.get(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED)
|
||||
ClientProperty.put(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED, false)
|
||||
try {
|
||||
action()
|
||||
} finally {
|
||||
ClientProperty.put(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED, previousAutoExpandValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private data object SelectFirstSibling : ActionNode<VimNavigationDispatcher<JTree>> {
|
||||
@ -166,6 +156,16 @@ internal object VimTreeNavigation {
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun runWithoutAutoExpand(tree: JTree, action: () -> Unit) {
|
||||
val previousAutoExpandValue = ClientProperty.get(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED)
|
||||
ClientProperty.put(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED, false)
|
||||
try {
|
||||
action()
|
||||
} finally {
|
||||
ClientProperty.put(tree, DefaultTreeUI.AUTO_EXPAND_ALLOWED, previousAutoExpandValue)
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectRow(tree: JTree, row: Int) {
|
||||
tree.setSelectionRow(row)
|
||||
tree.scrollRowToVisible(row)
|
||||
|
Loading…
Reference in New Issue
Block a user