Fixed weird spacing when using fonts with different heights in lines with empty text in the diff

This commit is contained in:
Abdelilah El Aissaoui 2022-02-11 20:34:13 +01:00
parent a3f233d363
commit c374ac77d5

View file

@ -290,6 +290,7 @@ fun DiffLine(highestLineNumberLength: Int, line: Line) {
Row( Row(
modifier = Modifier modifier = Modifier
.background(backgroundColor) .background(backgroundColor)
.height(IntrinsicSize.Min)
) { ) {
val oldLineText = if (line.lineType == LineType.REMOVED || line.lineType == LineType.CONTEXT) { val oldLineText = if (line.lineType == LineType.REMOVED || line.lineType == LineType.CONTEXT) {
formattedLineNumber(line.displayOldLineNumber, highestLineNumberLength) formattedLineNumber(line.displayOldLineNumber, highestLineNumberLength)
@ -315,7 +316,7 @@ fun DiffLine(highestLineNumberLength: Int, line: Line) {
text = line.text, text = line.text,
modifier = Modifier modifier = Modifier
.padding(start = 8.dp) .padding(start = 8.dp)
.fillMaxWidth(), .fillMaxSize(),
color = MaterialTheme.colors.primaryTextColor, color = MaterialTheme.colors.primaryTextColor,
maxLines = 1, maxLines = 1,
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
@ -331,6 +332,7 @@ fun LineNumber(text: String) {
color = MaterialTheme.colors.primaryTextColor, color = MaterialTheme.colors.primaryTextColor,
modifier = Modifier modifier = Modifier
.background(MaterialTheme.colors.surface) .background(MaterialTheme.colors.surface)
.fillMaxHeight()
.padding(horizontal = 4.dp), .padding(horizontal = 4.dp),
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
fontSize = 13.sp, fontSize = 13.sp,