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.MaterialTheme
|
||||||
import androidx.compose.material.TextFieldDefaults
|
import androidx.compose.material.TextFieldDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun textFieldColors() = TextFieldDefaults.textFieldColors(
|
fun textFieldColors(
|
||||||
cursorColor = MaterialTheme.colors.primaryVariant,
|
cursorColor: Color = MaterialTheme.colors.primaryVariant,
|
||||||
focusedIndicatorColor = MaterialTheme.colors.primaryVariant,
|
focusedIndicatorColor: Color = MaterialTheme.colors.primaryVariant,
|
||||||
focusedLabelColor = MaterialTheme.colors.primaryVariant,
|
focusedLabelColor: Color = MaterialTheme.colors.primaryVariant,
|
||||||
backgroundColor = MaterialTheme.colors.background,
|
backgroundColor: Color = MaterialTheme.colors.background,
|
||||||
textColor = MaterialTheme.colors.primaryTextColor,
|
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
|
@Composable
|
||||||
|
@ -164,38 +164,33 @@ fun UncommitedChanges(
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp)
|
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp)
|
||||||
.run {
|
.height(192.dp)
|
||||||
// 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
|
|
||||||
}
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
// Don't show the message TextField when rebasing as it can't be edited
|
// 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) },
|
value = commitMessage,
|
||||||
colors = textFieldColors(),
|
onValueChange = {
|
||||||
textStyle = TextStyle.Default.copy(fontSize = 14.sp, color = MaterialTheme.colors.primaryTextColor),
|
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 {
|
when {
|
||||||
repositoryState.isMerging -> MergeButtons(
|
repositoryState.isMerging -> MergeButtons(
|
||||||
|
@ -133,7 +133,10 @@ class StatusViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun messageByRepoState(git: Git): String {
|
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()
|
git.repository.readMergeCommitMsg()
|
||||||
} else {
|
} else {
|
||||||
git.repository.readCommitEditMsg()
|
git.repository.readCommitEditMsg()
|
||||||
|
Loading…
Reference in New Issue
Block a user