Fix conflict commit-all flow and terminal copy line breaks
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user