mirror of
https://github.com/chylex/IntelliJ-Keyboard-Master.git
synced 2025-05-03 14:34:06 +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)
|
tree.collapsePath(path)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tree.expandPath(path)
|
runWithoutAutoExpand(tree) { tree.expandPath(path) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,16 +116,6 @@ internal object VimTreeNavigation {
|
|||||||
pathsToExpand = nextPathsToExpand
|
pathsToExpand = nextPathsToExpand
|
||||||
} while (pathsToExpand.isNotEmpty())
|
} 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>> {
|
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) {
|
private fun selectRow(tree: JTree, row: Int) {
|
||||||
tree.setSelectionRow(row)
|
tree.setSelectionRow(row)
|
||||||
tree.scrollRowToVisible(row)
|
tree.scrollRowToVisible(row)
|
||||||
|
Loading…
Reference in New Issue
Block a user