Adding spell checking to CommitMessageTextBox

This commit is contained in:
Gustavo Hennig 2024-09-17 16:44:56 -03:00
parent 67b3952080
commit 8952209012
8 changed files with 502489 additions and 0 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,15 @@
<AvaloniaResource Include="Resources/Images/ShellIcons/*" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Dictionaries\en_GB.aff" />
<Content Include="Resources\Dictionaries\en_GB.dic" />
<Content Include="Resources\Dictionaries\es_MX.aff" />
<Content Include="Resources\Dictionaries\es_MX.dic" />
<Content Include="Resources\Dictionaries\pt_BR.aff" />
<Content Include="Resources\Dictionaries\pt_BR.dic" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.3" />
@ -46,6 +55,7 @@
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="GHSoftware.Avalonia.SpellChecker" Version="0.2.0" />
<PackageReference Include="TextMateSharp" Version="1.0.63" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.63" />
</ItemGroup>
@ -58,4 +68,14 @@
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<LinkerArg Include="-mmacosx-version-min=11.0" Condition="'$(Configuration)' == 'Release'" />
</ItemGroup>
<!-- Add a target to copy the files to the bin/Dictionaries folder -->
<Target Name="CopyDictionaries" AfterTargets="Build">
<ItemGroup>
<DictionaryFiles Include="Resources\Dictionaries\*" />
</ItemGroup>
<Copy SourceFiles="@(DictionaryFiles)" DestinationFolder="$(OutputPath)Dictionaries\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>
</Project>

View file

@ -4,6 +4,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.SpellChecker;
namespace SourceGit.Views
{
@ -49,6 +50,8 @@ namespace SourceGit.Views
public partial class CommitMessageTextBox : UserControl
{
private readonly TextBoxSpellChecker _textBoxSpellChecker;
public enum TextChangeWay
{
None,
@ -86,6 +89,9 @@ namespace SourceGit.Views
public CommitMessageTextBox()
{
InitializeComponent();
_textBoxSpellChecker = new TextBoxSpellChecker(SpellCheckerConfig.Create("en_GB"));
_textBoxSpellChecker.Initialize(SubjectEditor);
_textBoxSpellChecker.Initialize(DescriptionEditor);
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)