Fixed graph size not being recalculated after changing uncommited changes status
This commit is contained in:
parent
c71f7555de
commit
c20021832f
3 changed files with 17 additions and 9 deletions
|
@ -43,6 +43,8 @@ class LogManager @Inject constructor() {
|
|||
|
||||
}
|
||||
|
||||
commitList.calcMaxLine()
|
||||
|
||||
return@withContext commitList
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ class GraphCommitList : RevCommitList<GraphNode>() {
|
|||
private val freePositions = TreeSet<Int>()
|
||||
private val activeLanes = HashSet<GraphLane>(32)
|
||||
|
||||
var maxLine = 0
|
||||
private set
|
||||
|
||||
/** number of (child) commits on a lane */
|
||||
private val laneLength = HashMap<GraphLane, Int?>(
|
||||
32
|
||||
|
@ -346,4 +349,8 @@ class GraphCommitList : RevCommitList<GraphNode>() {
|
|||
for (l in graphNode.mergingLanes) blockedPositions.set(l.position)
|
||||
}
|
||||
}
|
||||
|
||||
fun calcMaxLine() {
|
||||
maxLine = this.maxOf { it.lane.position }
|
||||
}
|
||||
}
|
|
@ -241,7 +241,7 @@ fun SearchFilter(
|
|||
.focusRequester(textFieldFocusRequester)
|
||||
.onPreviewKeyEvent {
|
||||
when {
|
||||
it.key == Key.Enter && it.type == KeyEventType.KeyUp-> {
|
||||
it.key == Key.Enter && it.type == KeyEventType.KeyUp -> {
|
||||
scope.launch {
|
||||
logViewModel.selectNextFilterCommit()
|
||||
}
|
||||
|
@ -334,7 +334,8 @@ fun MessagesList(
|
|||
})
|
||||
}
|
||||
items(items = commitList) { graphNode ->
|
||||
CommitLine(graphWidth = graphWidth,
|
||||
CommitLine(
|
||||
graphWidth = graphWidth,
|
||||
logViewModel = logViewModel,
|
||||
graphNode = graphNode,
|
||||
selected = selectedCommit?.name == graphNode.name,
|
||||
|
@ -363,14 +364,12 @@ fun GraphList(
|
|||
scrollState: LazyListState,
|
||||
hasUncommitedChanges: Boolean,
|
||||
) {
|
||||
val graphRealWidth = remember(commitList, graphWidth) {
|
||||
val maxLinePosition = if (commitList.isNotEmpty())
|
||||
commitList.maxOf { it.lane.position }
|
||||
else
|
||||
MIN_GRAPH_LANES
|
||||
val maxLinePosition = if (commitList.isNotEmpty())
|
||||
commitList.maxLine
|
||||
else
|
||||
MIN_GRAPH_LANES
|
||||
|
||||
((maxLinePosition + MARGIN_GRAPH_LANES) * LANE_WIDTH).dp
|
||||
}
|
||||
val graphRealWidth = ((maxLinePosition + MARGIN_GRAPH_LANES) * LANE_WIDTH).dp
|
||||
|
||||
Box(
|
||||
Modifier.width(graphWidth).fillMaxHeight()
|
||||
|
|
Loading…
Reference in a new issue