From 4a90e1c75795b08bb406f5aaf18f0a4af39abbd9 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Sat, 5 Nov 2022 00:25:45 +0100 Subject: [PATCH] Improved graph visualization --- .../com/jetpackduba/gitnuro/git/graph/GraphCommitList.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/graph/GraphCommitList.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/graph/GraphCommitList.kt index cd1e59b..240ff77 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/graph/GraphCommitList.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/graph/GraphCommitList.kt @@ -112,8 +112,9 @@ class GraphCommitList : RevCommitList() { lengthOfReservedLane = length } } else { + val children = currCommit.children.sortedBy { it.lane.position } for (i in 0 until nChildren) { - val c: GraphNode = currCommit.children[i] + val c: GraphNode = children[i] if (c.getGraphParent(0) === currCommit) { if (c.lane.position < 0) println("c.lane.position is invalid (${c.lane.position})") @@ -126,6 +127,8 @@ class GraphCommitList : RevCommitList() { reservedLane = c.lane childOnReservedLane = c lengthOfReservedLane = length + + break } } }