Remove empty terminal black areas
- Hide the terminal output viewport when there are no output lines on a newly loaded level. - Reduce the minimum output history height so short output does not create a large empty black panel. - Use the pane surface color for the app background so normal spacing between cards is not black.
This commit is contained in:
@@ -3,10 +3,10 @@ package solutions.tretter.githugandroid
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val AppBackground = Color(0xFF000000)
|
||||
val PanelPrimary = Color(0xFF121212)
|
||||
val PanelSecondary = Color(0xFF1E1E1E)
|
||||
val PanelTertiary = Color(0xFF262626)
|
||||
val AppBackground = PanelSecondary
|
||||
val TerminalBackground = Color(0xFF050505)
|
||||
val TextPrimary = Color(0xFFFFFFFF)
|
||||
val TextSecondary = Color(0xFFE6E6E6)
|
||||
@@ -26,4 +26,4 @@ val GitHugColorScheme = darkColorScheme(
|
||||
surfaceVariant = PanelSecondary,
|
||||
onSurfaceVariant = TextSecondary,
|
||||
outline = TextMuted,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -82,7 +82,11 @@ fun TerminalPane(
|
||||
val reservedControlsHeight = 86.dp
|
||||
val maxOutputHeight = (terminalPaneMaxHeight - reservedControlsHeight).coerceAtLeast(120.dp)
|
||||
val outputLineHeight = 20.dp
|
||||
val desiredOutputHeight = (output.size.coerceAtLeast(6) * outputLineHeight.value).dp.coerceAtMost(maxOutputHeight)
|
||||
val hasOutput = output.isNotEmpty()
|
||||
val desiredOutputHeight = (output.size.coerceAtLeast(1) * outputLineHeight.value)
|
||||
.dp
|
||||
.coerceAtLeast(48.dp)
|
||||
.coerceAtMost(maxOutputHeight)
|
||||
|
||||
LaunchedEffect(inputFieldVersion) {
|
||||
outputHorizontalScroll.scrollTo(0)
|
||||
@@ -120,28 +124,30 @@ fun TerminalPane(
|
||||
.widthIn(min = terminalMinWidth),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.heightIn(min = 200.dp, max = maxOutputHeight)
|
||||
.height(desiredOutputHeight)
|
||||
.fillMaxWidth()
|
||||
.background(PanelPrimary, RoundedCornerShape(10.dp))
|
||||
.padding(8.dp)
|
||||
.horizontalScroll(outputHorizontalScroll)
|
||||
.verticalScroll(outputVerticalScroll),
|
||||
) {
|
||||
SelectionContainer {
|
||||
Column(
|
||||
modifier = Modifier.widthIn(min = terminalMinWidth),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
output.forEach { line ->
|
||||
Text(
|
||||
text = line,
|
||||
color = if (line.startsWith("✔") || line.startsWith("🏁")) Success else TextSecondary,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
softWrap = false,
|
||||
)
|
||||
if (hasOutput) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.heightIn(max = maxOutputHeight)
|
||||
.height(desiredOutputHeight)
|
||||
.fillMaxWidth()
|
||||
.background(PanelPrimary, RoundedCornerShape(10.dp))
|
||||
.padding(8.dp)
|
||||
.horizontalScroll(outputHorizontalScroll)
|
||||
.verticalScroll(outputVerticalScroll),
|
||||
) {
|
||||
SelectionContainer {
|
||||
Column(
|
||||
modifier = Modifier.widthIn(min = terminalMinWidth),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
output.forEach { line ->
|
||||
Text(
|
||||
text = line,
|
||||
color = if (line.startsWith("✔") || line.startsWith("🏁")) Success else TextSecondary,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
softWrap = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user