From b1d5c57e049fd2df3379a8ab7337328c48703490 Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Thu, 16 May 2024 12:32:22 +0200 Subject: [PATCH] Fix not scrolling selected row into view when jumping to first/last sibling --- .../vimNavigation/components/VimTreeNavigation.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) + } }