Rebase conflict now shows current commit message as read-only
This commit is contained in:
parent
dc45551259
commit
86a7f85e74
@ -4,14 +4,23 @@ import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
@Composable
|
||||
fun textFieldColors() = TextFieldDefaults.textFieldColors(
|
||||
cursorColor = MaterialTheme.colors.primaryVariant,
|
||||
focusedIndicatorColor = MaterialTheme.colors.primaryVariant,
|
||||
focusedLabelColor = MaterialTheme.colors.primaryVariant,
|
||||
backgroundColor = MaterialTheme.colors.background,
|
||||
textColor = MaterialTheme.colors.primaryTextColor,
|
||||
fun textFieldColors(
|
||||
cursorColor: Color = MaterialTheme.colors.primaryVariant,
|
||||
focusedIndicatorColor: Color = MaterialTheme.colors.primaryVariant,
|
||||
focusedLabelColor: Color = MaterialTheme.colors.primaryVariant,
|
||||
backgroundColor: Color = MaterialTheme.colors.background,
|
||||
textColor: Color = MaterialTheme.colors.primaryTextColor,
|
||||
disabledTextColor: Color = MaterialTheme.colors.secondaryTextColor,
|
||||
) = TextFieldDefaults.textFieldColors(
|
||||
cursorColor = cursorColor,
|
||||
focusedIndicatorColor = focusedIndicatorColor,
|
||||
focusedLabelColor = focusedLabelColor,
|
||||
backgroundColor = backgroundColor,
|
||||
textColor = textColor,
|
||||
disabledTextColor = disabledTextColor,
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
@ -164,38 +164,33 @@ fun UncommitedChanges(
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp)
|
||||
.run {
|
||||
// When rebasing, we don't need a fixed size as we don't show the message TextField
|
||||
if (!repositoryState.isRebasing) {
|
||||
height(192.dp)
|
||||
} else
|
||||
this
|
||||
}
|
||||
.height(192.dp)
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
// Don't show the message TextField when rebasing as it can't be edited
|
||||
if (!repositoryState.isRebasing)
|
||||
TextField(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(weight = 1f, fill = true)
|
||||
.onPreviewKeyEvent {
|
||||
if (it.isCtrlPressed && it.key == Key.Enter && canCommit) {
|
||||
doCommit(false)
|
||||
true
|
||||
} else
|
||||
false
|
||||
},
|
||||
value = commitMessage,
|
||||
onValueChange = {
|
||||
commitMessage = it
|
||||
|
||||
statusViewModel.updateCommitMessage(it)
|
||||
TextField(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(weight = 1f, fill = true)
|
||||
.onPreviewKeyEvent {
|
||||
if (it.isCtrlPressed && it.key == Key.Enter && canCommit) {
|
||||
doCommit(false)
|
||||
true
|
||||
} else
|
||||
false
|
||||
},
|
||||
label = { Text("Write your commit message here", fontSize = 14.sp) },
|
||||
colors = textFieldColors(),
|
||||
textStyle = TextStyle.Default.copy(fontSize = 14.sp, color = MaterialTheme.colors.primaryTextColor),
|
||||
)
|
||||
value = commitMessage,
|
||||
onValueChange = {
|
||||
commitMessage = it
|
||||
|
||||
statusViewModel.updateCommitMessage(it)
|
||||
},
|
||||
enabled = !repositoryState.isRebasing,
|
||||
label = { Text("Write your commit message here", fontSize = 14.sp) },
|
||||
colors = textFieldColors(),
|
||||
textStyle = TextStyle.Default.copy(fontSize = 14.sp),
|
||||
)
|
||||
|
||||
when {
|
||||
repositoryState.isMerging -> MergeButtons(
|
||||
|
@ -133,7 +133,10 @@ class StatusViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
private fun messageByRepoState(git: Git): String {
|
||||
val message: String? = if (git.repository.repositoryState == RepositoryState.MERGING) {
|
||||
val message: String? = if (
|
||||
git.repository.repositoryState == RepositoryState.MERGING ||
|
||||
git.repository.repositoryState == RepositoryState.REBASING_MERGE
|
||||
) {
|
||||
git.repository.readMergeCommitMsg()
|
||||
} else {
|
||||
git.repository.readCommitEditMsg()
|
||||
|
Loading…
Reference in New Issue
Block a user