diff --git a/src/main/kotlin/com/chylex/intellij/keyboardmaster/feature/vimNavigation/components/VimTreeNavigation.kt b/src/main/kotlin/com/chylex/intellij/keyboardmaster/feature/vimNavigation/components/VimTreeNavigation.kt index 875898d..2f8e304 100644 --- a/src/main/kotlin/com/chylex/intellij/keyboardmaster/feature/vimNavigation/components/VimTreeNavigation.kt +++ b/src/main/kotlin/com/chylex/intellij/keyboardmaster/feature/vimNavigation/components/VimTreeNavigation.kt @@ -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) + } }