revert: "refactor: commit message editor (#2096)"

This reverts commit ceea4a18fc.
This commit is contained in:
leo
2026-02-25 10:32:47 +08:00
parent 9910c88104
commit df09ce01fa
2 changed files with 11 additions and 8 deletions

View File

@@ -37,10 +37,12 @@
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="8">
<v:CommitMessageToolBox x:Name="Editor" Height="400"/>
<Button Width="0" Height="0"
Margin="0" Padding="0"
Click="OnCloseByHotKey"
HotKey="Escape"/>
<Button Classes="flat primary"
Width="80"
Margin="0,8,0,4"
Content="{DynamicResource Text.Sure}"
Click="SaveAndClose"
HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</v:ChromelessWindow>

View File

@@ -60,18 +60,19 @@ namespace SourceGit.Views
{
base.OnClosed(e);
_onSave?.Invoke(Editor.CommitMessage);
if (_shouldExitApp)
App.Quit(0);
App.Quit(_exitCode);
}
private void OnCloseByHotKey(object sender, RoutedEventArgs e)
private void SaveAndClose(object _1, RoutedEventArgs _2)
{
_onSave?.Invoke(Editor.CommitMessage);
_exitCode = 0;
Close();
}
private Action<string> _onSave = null;
private bool _shouldExitApp = true;
private int _exitCode = -1;
}
}