mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +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
|
@ -39,12 +39,12 @@
|
|||
|
||||
<!-- AI response -->
|
||||
<v:AIResponseView Grid.Row="1"
|
||||
x:Name="TxtResponse"
|
||||
Margin="8"
|
||||
Height="320"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}"/>
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
Content="{Binding Text}"/>
|
||||
|
||||
<!-- Options -->
|
||||
<Border Grid.Row="2" Margin="0,0,0,8">
|
||||
|
|
|
@ -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