Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.vs/
.vscode/
.idea/
# DevExpress CodeRush related files
.cr/

*.sln.docstates
*.user
Expand Down
6 changes: 3 additions & 3 deletions src/Views/CommitMessageToolBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<Button Grid.Column="0"
Classes="icon_button"
Width="24"
Margin="0,0,4,0" Padding="0"
Margin="0,0,4,0" Padding="4"
Click="OnOpenCommitMessagePicker"
IsVisible="{Binding #ThisControl.ShowAdvancedOptions}"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.CommitMessageHelper}">
Expand All @@ -48,7 +48,7 @@
<Button Grid.Column="1"
Classes="icon_button"
Width="24"
Margin="0,0,4,0" Padding="0"
Margin="0,0,4,0" Padding="4"
Click="OnOpenOpenAIHelper"
IsVisible="{Binding #ThisControl.ShowAdvancedOptions}"
ToolTip.Tip="{DynamicResource Text.AIAssistant.Tip}">
Expand All @@ -58,7 +58,7 @@
<Button Grid.Column="2"
Classes="icon_button"
Width="24"
Margin="0,0,4,0" Padding="0"
Margin="0,0,4,0" Padding="4"
Click="OnOpenConventionalCommitHelper"
ToolTip.Tip="{DynamicResource Text.ConventionalCommit}">
<Path Width="13" Height="13" Margin="0,1,0,0" Data="{StaticResource Icons.CommitMessageGenerator}"/>
Expand Down
30 changes: 29 additions & 1 deletion src/Views/CommitMessageToolBox.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;

using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
Expand Down Expand Up @@ -365,8 +365,16 @@ public CommitMessageToolBox()
InitializeComponent();
}

private ContextMenu _commitMessagePickerMenu = null;

private async void OnOpenCommitMessagePicker(object sender, RoutedEventArgs e)
{
if (_commitMessagePickerMenu != null)
{
e.Handled = true;
return;
}

if (sender is Button button && DataContext is ViewModels.WorkingCopy vm && ShowAdvancedOptions)
{
var repo = vm.Repository;
Expand Down Expand Up @@ -478,14 +486,28 @@ private async void OnOpenCommitMessagePicker(object sender, RoutedEventArgs e)
}

menu.Placement = PlacementMode.TopEdgeAlignedLeft;
menu.Closed += async (_, _) =>
{
await Task.Delay(100); // Let the click event be processed
_commitMessagePickerMenu = null;
};
_commitMessagePickerMenu = menu;
menu.Open(button);
}

e.Handled = true;
}

private ContextMenu _openAIHelperMenu = null;

private async void OnOpenOpenAIHelper(object sender, RoutedEventArgs e)
{
if (_openAIHelperMenu != null)
{
e.Handled = true;
return;
}

if (DataContext is ViewModels.WorkingCopy vm && sender is Control control && ShowAdvancedOptions)
{
var repo = vm.Repository;
Expand Down Expand Up @@ -523,6 +545,12 @@ private async void OnOpenOpenAIHelper(object sender, RoutedEventArgs e)

menu.Items.Add(item);
}
menu.Closed += async (_, _) =>
{
await Task.Delay(100); // Let the click event be processed
_openAIHelperMenu = null;
};
_openAIHelperMenu = menu;
menu.Open(control);
}

Expand Down