mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-27 21:35:00 +00:00
fix: empty dialog when generating commit message with AI (#1257)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
226bc434f5
commit
5681bf489d
2 changed files with 21 additions and 2 deletions
|
@ -15,6 +15,15 @@ namespace SourceGit.Views
|
|||
{
|
||||
public class AIResponseView : TextEditor
|
||||
{
|
||||
public static readonly StyledProperty<string> ContentProperty =
|
||||
AvaloniaProperty.Register<AIResponseView, string>(nameof(Content), string.Empty);
|
||||
|
||||
public string Content
|
||||
{
|
||||
get => GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(TextEditor);
|
||||
|
||||
public AIResponseView() : base(new TextArea(), new TextDocument())
|
||||
|
@ -58,6 +67,16 @@ namespace SourceGit.Views
|
|||
GC.Collect();
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
||||
if (change.Property == ContentProperty)
|
||||
{
|
||||
Text = Content;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
var selected = SelectedText;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue