Skip to content

Commit e1dbca2

Browse files
authored
Merge pull request #170 from skirge/bug-nav
correct navigation from rules view and location view
2 parents 91ecf41 + 1c98766 commit e1dbca2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow/SarifViewerWindowFactory.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,13 @@ class SarifViewerWindowFactory : ToolWindowFactory {
444444
myList.addTreeSelectionListener(object : TreeSelectionListener {
445445
override fun valueChanged(e: TreeSelectionEvent?) {
446446
if (e != null && e.isAddedPath) {
447-
val leaves = map[e.path.parentPath.lastPathComponent.toString().split(" ").first()]
447+
val key = e.path.parentPath.lastPathComponent.toString()
448+
// path (count)
449+
val leaves1 = map[key.split(" ").first()]
450+
// bug desc (count)
451+
val leaves2 = map[key.substring(0, key.lastIndexOf(' '))]
452+
val leaves = (leaves1.orEmpty() + leaves2.orEmpty()).takeIf { it.isNotEmpty() }
453+
448454
if (!leaves.isNullOrEmpty()) {
449455
currentLeaf = try {
450456
leaves.first { it.address == ((e.path.lastPathComponent as DefaultMutableTreeNode).userObject as Leaf).address }

0 commit comments

Comments
 (0)