refactor<Configure>: remove commit template due to bad implementation

This commit is contained in:
leo 2021-04-06 16:06:36 +08:00
parent c233ffabdd
commit 1366d8e858
5 changed files with 2 additions and 38 deletions

View file

@ -54,10 +54,6 @@ namespace SourceGit.Git {
/// Last 10 Commit message.
/// </summary>
public List<string> CommitMsgRecords { get; set; } = new List<string>();
/// <summary>
/// Commit template.
/// </summary>
public string CommitTemplate { get; set; }
#endregion
#region PROPERTIES_RUNTIME

View file

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="clr-namespace:SourceGit.Helpers"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="500" Width="500" Height="314">
d:DesignHeight="150" d:DesignWidth="500" Width="500" Height="150">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="36"/>
@ -14,10 +14,6 @@
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="18"/>
<RowDefinition Height="36"/>
<RowDefinition Height="8"/>
<RowDefinition Height="102"/>
<RowDefinition Height="18"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
@ -43,20 +39,8 @@
Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}"
helpers:TextBoxHelper.Placeholder="{StaticResource Text.Configure.Email.Placeholder}"/>
<!-- 提交模板 -->
<Label Grid.Row="5" Grid.ColumnSpan="2" Content="{StaticResource Text.Configure.CommitTemplate}" FontSize="16" FontWeight="DemiBold" Opacity=".85"/>
<Label Grid.Row="7" Grid.Column="0" Content="{StaticResource Text.Configure.Template}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
<TextBox
Grid.Row="7"
Grid.Column="1"
Height="100"
AcceptsReturn="True"
AcceptsTab="True"
Padding="2"
Text="{Binding ElementName=me, Path=CommitTemplate, Mode=TwoWay}"/>
<!-- 操作 -->
<Grid Grid.Row="9" Grid.ColumnSpan="2">
<Grid Grid.Row="5" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>

View file

@ -33,7 +33,6 @@ namespace SourceGit.UI {
UserName = repo.GetConfig("user.name");
UserEmail = repo.GetConfig("user.email");
CommitTemplate = repo.CommitTemplate;
InitializeComponent();
}
@ -54,11 +53,6 @@ namespace SourceGit.UI {
var oldEmail = repo.GetConfig("user.email");
if (oldEmail != UserEmail) repo.SetConfig("user.email", UserEmail);
if (CommitTemplate != repo.CommitTemplate) {
repo.CommitTemplate = CommitTemplate;
App.SaveSetting();
}
Close(sender, e);
}

View file

@ -392,7 +392,6 @@
ScrollViewer.VerticalScrollBarVisibility="Auto"
helpers:TextBoxHelper.Placeholder="{StaticResource Text.WorkingCopy.CommitMessageTip}"
helpers:TextBoxHelper.PlaceholderBaseline="Top"
GotFocus="CommitMsgGotFocus"
PreviewMouseWheel="CommitMsgPreviewMouseWheel">
<TextBox.Text>
<Binding ElementName="me" Path="CommitMessage" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">

View file

@ -839,15 +839,6 @@ namespace SourceGit.UI {
#endregion
#region COMMIT_PANEL
private void CommitMsgGotFocus(object sender, RoutedEventArgs e) {
var textBox = sender as TextBox;
if (textBox == null) return;
if (string.IsNullOrEmpty(textBox.Text) && !string.IsNullOrEmpty(Repo.CommitTemplate)) {
textBox.Text = Repo.CommitTemplate;
}
}
private void CommitMsgPreviewMouseWheel(object sender, MouseWheelEventArgs e) {
var textBox = sender as TextBox;
if (textBox == null) return;