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