Compare commits

...

1 commit

Author SHA1 Message Date
Gustavo Hennig
8952209012 Adding spell checking to CommitMessageTextBox 2024-09-17 16:44:56 -03:00
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/*" /> <AvaloniaResource Include="Resources/Images/ShellIcons/*" />
</ItemGroup> </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> <ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.3" /> <PackageReference Include="Avalonia" Version="11.1.3" />
<PackageReference Include="Avalonia.Desktop" 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="Avalonia.AvaloniaEdit" Version="11.1.0" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" /> <PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /> <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" Version="1.0.63" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.63" /> <PackageReference Include="TextMateSharp.Grammars" Version="1.0.63" />
</ItemGroup> </ItemGroup>
@ -58,4 +68,14 @@
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))"> <ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<LinkerArg Include="-mmacosx-version-min=11.0" Condition="'$(Configuration)' == 'Release'" /> <LinkerArg Include="-mmacosx-version-min=11.0" Condition="'$(Configuration)' == 'Release'" />
</ItemGroup> </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> </Project>

View file

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