Fix conflict commit-all flow and terminal copy line breaks

This commit is contained in:
Joe Tretter
2026-05-19 16:35:00 -05:00
parent ceb0d503f4
commit a1bb78c600
4 changed files with 36 additions and 14 deletions

View File

@@ -19,8 +19,8 @@ android {
applicationId = "solutions.tretter.githugandroid"
minSdk = 26
targetSdk = 35
versionCode = 163
versionName = "0.1.162"
versionCode = 164
versionName = "0.1.163"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

View File

@@ -45,10 +45,13 @@ import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.TextFieldValue
@@ -83,6 +86,17 @@ fun TerminalPane(
val outputVerticalScroll = rememberScrollState()
val terminalMinWidth = 80.dp * 7.2f
val displayOutput = remember(output) { terminalOutputDisplayLines(output) }
val displayOutputText = remember(displayOutput) {
buildAnnotatedString {
displayOutput.forEachIndexed { index, line ->
if (index > 0) append('\n')
val lineColor = if (line.startsWith("") || line.startsWith("🏁")) Success else TextSecondary
withStyle(SpanStyle(color = lineColor)) {
append(line)
}
}
}
}
val maxOutputHeight = (configuration.screenHeightDp.dp * 0.8f).coerceAtLeast(120.dp)
val outputLineHeight = 24.dp
val hasOutput = displayOutput.isNotEmpty()
@@ -139,19 +153,13 @@ fun TerminalPane(
.verticalScroll(outputVerticalScroll),
) {
SelectionContainer {
Column(
Text(
text = displayOutputText,
modifier = Modifier.widthIn(min = terminalMinWidth),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
displayOutput.forEach { line ->
Text(
text = line,
color = if (line.startsWith("") || line.startsWith("🏁")) Success else TextSecondary,
fontFamily = FontFamily.Monospace,
softWrap = false,
)
}
}
fontFamily = FontFamily.Monospace,
lineHeight = outputLineHeight.value.sp,
softWrap = false,
)
}
}
}

View File

@@ -56,6 +56,15 @@ internal fun conflictLevel(): Level = level(
"git add poem.txt",
"git commit --no-edit",
),
levelTestCase(
"merge and resolve with commit all",
"git merge mybranch",
"echo \"Humpty dumpty\" > poem.txt",
"echo \"Sat on a wall\" >> poem.txt",
"echo \"Humpty dumpty\" >> poem.txt",
"echo \"Had a great fall\" >> poem.txt",
"git commit -am \"Resolve conflict\"",
),
),
negativeTestCases = listOf(
levelTestCase(

View File

@@ -18,6 +18,11 @@ class GitEditorCommandsTest {
assertNull(parseGitEditorInvocation("git commit -m \"message\""))
}
@Test
fun commitAllWithCombinedMessageOptionDoesNotOpenEditor() {
assertNull(parseGitEditorInvocation("git commit -am \"message\""))
}
@Test
fun amendNoEditDoesNotOpenEditor() {
assertNull(parseGitEditorInvocation("git commit --amend --no-edit"))