Fix conflict commit-all flow and terminal copy line breaks
This commit is contained in:
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "solutions.tretter.githugandroid"
|
applicationId = "solutions.tretter.githugandroid"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 163
|
versionCode = 164
|
||||||
versionName = "0.1.162"
|
versionName = "0.1.163"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|||||||
@@ -45,10 +45,13 @@ import androidx.compose.ui.input.key.key
|
|||||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||||
import androidx.compose.ui.input.key.type
|
import androidx.compose.ui.input.key.type
|
||||||
import androidx.compose.ui.platform.LocalConfiguration
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
import androidx.compose.ui.text.TextRange
|
import androidx.compose.ui.text.TextRange
|
||||||
import androidx.compose.ui.text.TextStyle
|
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.FontFamily
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
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.ImeAction
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
@@ -83,6 +86,17 @@ fun TerminalPane(
|
|||||||
val outputVerticalScroll = rememberScrollState()
|
val outputVerticalScroll = rememberScrollState()
|
||||||
val terminalMinWidth = 80.dp * 7.2f
|
val terminalMinWidth = 80.dp * 7.2f
|
||||||
val displayOutput = remember(output) { terminalOutputDisplayLines(output) }
|
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 maxOutputHeight = (configuration.screenHeightDp.dp * 0.8f).coerceAtLeast(120.dp)
|
||||||
val outputLineHeight = 24.dp
|
val outputLineHeight = 24.dp
|
||||||
val hasOutput = displayOutput.isNotEmpty()
|
val hasOutput = displayOutput.isNotEmpty()
|
||||||
@@ -139,22 +153,16 @@ fun TerminalPane(
|
|||||||
.verticalScroll(outputVerticalScroll),
|
.verticalScroll(outputVerticalScroll),
|
||||||
) {
|
) {
|
||||||
SelectionContainer {
|
SelectionContainer {
|
||||||
Column(
|
|
||||||
modifier = Modifier.widthIn(min = terminalMinWidth),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
|
||||||
) {
|
|
||||||
displayOutput.forEach { line ->
|
|
||||||
Text(
|
Text(
|
||||||
text = line,
|
text = displayOutputText,
|
||||||
color = if (line.startsWith("✔") || line.startsWith("🏁")) Success else TextSecondary,
|
modifier = Modifier.widthIn(min = terminalMinWidth),
|
||||||
fontFamily = FontFamily.Monospace,
|
fontFamily = FontFamily.Monospace,
|
||||||
|
lineHeight = outputLineHeight.value.sp,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
SpecialKeyBar(
|
SpecialKeyBar(
|
||||||
onTab = onTab,
|
onTab = onTab,
|
||||||
onHelp = onHelp,
|
onHelp = onHelp,
|
||||||
|
|||||||
@@ -56,6 +56,15 @@ internal fun conflictLevel(): Level = level(
|
|||||||
"git add poem.txt",
|
"git add poem.txt",
|
||||||
"git commit --no-edit",
|
"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(
|
negativeTestCases = listOf(
|
||||||
levelTestCase(
|
levelTestCase(
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ class GitEditorCommandsTest {
|
|||||||
assertNull(parseGitEditorInvocation("git commit -m \"message\""))
|
assertNull(parseGitEditorInvocation("git commit -m \"message\""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun commitAllWithCombinedMessageOptionDoesNotOpenEditor() {
|
||||||
|
assertNull(parseGitEditorInvocation("git commit -am \"message\""))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun amendNoEditDoesNotOpenEditor() {
|
fun amendNoEditDoesNotOpenEditor() {
|
||||||
assertNull(parseGitEditorInvocation("git commit --amend --no-edit"))
|
assertNull(parseGitEditorInvocation("git commit --amend --no-edit"))
|
||||||
|
|||||||
Reference in New Issue
Block a user