Fixed diff lines being cut

This commit is contained in:
Abdelilah El Aissaoui 2022-08-05 01:38:44 +02:00
parent b950dc13fc
commit ef384007d3
2 changed files with 7 additions and 3 deletions

View File

@ -30,6 +30,10 @@ val String.dirPath: String
this
}
fun String.removeLineEndings(): String {
return this.removeSuffix("\n")
.removeSuffix("\r\n")
}
val String.lineDelimiter: String?
get() {

View File

@ -33,6 +33,7 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.extensions.removeLineEndings
import app.extensions.toStringWithSpaces
import app.git.DiffEntryType
import app.git.EntryContent
@ -435,14 +436,13 @@ fun DiffLine(
}
Text(
text = line.text.replace(
text = line.text.replace( // TODO this replace is a workaround until this issue gets fixed https://github.com/JetBrains/compose-jb/issues/615
"\t",
" "
), // TODO this replace is a workaround until this issue gets fixed https://github.com/JetBrains/compose-jb/issues/615
).removeLineEndings(),
modifier = Modifier
.padding(start = 8.dp)
.fillMaxSize(),
maxLines = 1,
fontFamily = FontFamily.Monospace,
style = MaterialTheme.typography.body2,
overflow = TextOverflow.Visible,