Skip to content

Commit 28d0123

Browse files
Bug fixes
1 parent b91b04d commit 28d0123

File tree

10 files changed

+134
-3051
lines changed

10 files changed

+134
-3051
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# IDE0055: Formatierung beheben
4+
dotnet_diagnostic.IDE0055.severity = none

CodeEditor-WinUI-TestApp/CodeWriter-WinUI-TestApp (Package)/CodeEditor-WinUI-TestApp (Package).wapproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@
8282
</ProjectReference>
8383
</ItemGroup>
8484
<ItemGroup>
85-
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.2]">
85+
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.5">
8686
<IncludeAssets>build</IncludeAssets>
8787
</PackageReference>
88-
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.2]">
88+
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.5">
8989
<IncludeAssets>build</IncludeAssets>
9090
</PackageReference>
9191
</ItemGroup>

CodeEditor-WinUI-TestApp/CodeWriter-WinUI-TestApp/CodeEditor-WinUI-TestApp.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
</ItemGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.2" />
29-
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.2" />
30-
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.2" />
28+
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.5" />
29+
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.5" />
30+
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.5" />
3131
<Manifest Include="$(ApplicationManifest)" />
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<ProjectReference Include="..\..\CodeEditorControl-WinUI\CodeEditorControl-WinUI.csproj" />
35+
<ProjectReference Include="..\..\..\..\..\..\..\..\ConTeXt-IDE-WinUI\CodeEditorControl-WinUI\CodeEditorControl-WinUI.csproj" />
3636
</ItemGroup>
3737
</Project>

CodeEditor-WinUI-TestApp/CodeWriter-WinUI-TestApp/MainPage.xaml

+54-53
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,61 @@
1010
RequestedTheme="{Binding RequestedTheme, Mode=OneWay}"
1111
Background="{ThemeResource SystemControlAcrylicWindowBrush}"
1212
>
13-
<Grid RowSpacing="12">
14-
<Grid.ColumnDefinitions>
15-
<ColumnDefinition />
16-
</Grid.ColumnDefinitions>
17-
<Grid.RowDefinitions>
18-
<RowDefinition Height="Auto" />
19-
<RowDefinition Height="*" />
20-
<RowDefinition Height="Auto" />
21-
</Grid.RowDefinitions>
22-
<ScrollViewer Padding="12,12,0,0" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Disabled" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Hidden" >
23-
<StackPanel Orientation="Horizontal" Spacing="6" >
24-
<Button x:Name="Btn_Load" Content="Load Textfile" Click="Btn_Load_Click"/>
25-
<Button x:Name="Btn_Save" Visibility="Collapsed" Content="Save Text" Click="Btn_Save_Click"/>
26-
<CheckBox Content="Unsaved Changes" IsChecked="{Binding UnsavedChanges, Mode=OneWay}" IsHitTestVisible="False" />
27-
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
28-
<TextBlock Text="Selection: "></TextBlock>
29-
<TextBlock Text="{Binding ElementName=CW, Path=Selection.Start}"></TextBlock>
30-
<TextBlock Text="-->"></TextBlock>
31-
<TextBlock Text="{Binding ElementName=CW, Path=Selection.End}"></TextBlock>
32-
</StackPanel>
33-
<ComboBox VerticalAlignment="Center" ItemsSource="{Binding ThemeOptions}" SelectedItem="{Binding Theme, Mode=TwoWay}"></ComboBox>
34-
<Button Content="Add Action" Click="Btn_Add_Click"></Button>
35-
<Button Content="Options">
36-
<Button.Flyout>
37-
<Flyout>
38-
<StackPanel>
39-
<Slider Width="150" Header="Font Size" Value="{Binding FontSize, Mode=TwoWay}" Minimum="6" Maximum="64"/>
40-
<Slider Width="150" Header="Tab Length" Value="{Binding TabLength, Mode=TwoWay}" Minimum="0" Maximum="5"/>
13+
<Grid RowSpacing="12">
14+
<Grid.ColumnDefinitions>
15+
<ColumnDefinition />
16+
</Grid.ColumnDefinitions>
17+
<Grid.RowDefinitions>
18+
<RowDefinition Height="Auto" />
19+
<RowDefinition Height="*" />
20+
<RowDefinition Height="Auto" />
21+
</Grid.RowDefinitions>
22+
<ScrollViewer Padding="12,12,0,0" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Disabled" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Hidden" >
23+
<StackPanel Orientation="Horizontal" Spacing="6" >
24+
<Button x:Name="Btn_Load" Content="Load Textfile" Click="Btn_Load_Click"/>
25+
<Button x:Name="Btn_Save" Visibility="Collapsed" Content="Save Text" Click="Btn_Save_Click"/>
26+
<CheckBox Content="Unsaved Changes" IsChecked="{Binding UnsavedChanges, Mode=OneWay}" IsHitTestVisible="False" />
27+
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
28+
<TextBlock Text="Selection: "></TextBlock>
29+
<TextBlock Text="{Binding ElementName=CW, Path=Selection.Start}"></TextBlock>
30+
<TextBlock Text="-->"></TextBlock>
31+
<TextBlock Text="{Binding ElementName=CW, Path=Selection.End}"></TextBlock>
32+
</StackPanel>
33+
<ComboBox VerticalAlignment="Center" ItemsSource="{Binding ThemeOptions}" SelectedItem="{Binding Theme, Mode=TwoWay}"></ComboBox>
34+
<Button Content="Add Action" Click="Btn_Add_Click"></Button>
35+
<Button Content="Options">
36+
<Button.Flyout>
37+
<Flyout>
38+
<StackPanel>
39+
<Slider Width="150" Header="Font Size" Value="{Binding FontSize, Mode=TwoWay}" Minimum="6" Maximum="64"/>
40+
<Slider Width="150" Header="Tab Length" Value="{Binding TabLength, Mode=TwoWay}" Minimum="0" Maximum="5"/>
4141

42-
<CheckBox Content="Enable code folding" IsChecked="{Binding IsFoldingEnabled, Mode=TwoWay}" />
43-
<CheckBox Content="Show line numbers" IsChecked="{Binding ShowLineNumbers, Mode=TwoWay}" />
44-
<CheckBox Content="Show tab/newline markers" IsChecked="{Binding ShowControlCharacters, Mode=TwoWay}" />
45-
<CheckBox Content="Show warning/error markers" IsChecked="{Binding ShowLineMarkers, Mode=TwoWay}" />
46-
<CheckBox Content="Show scrollbar markers" IsChecked="{Binding ShowScrollbarMarkers, Mode=TwoWay}" />
47-
<CheckBox Content="Show horizontal ticks (10 chars)" IsChecked="{Binding ShowHorizontalTicks, Mode=TwoWay}" />
48-
</StackPanel>
49-
</Flyout>
50-
</Button.Flyout>
51-
</Button>
52-
<ComboBox VerticalAlignment="Center" ItemsSource="{Binding LanguageOptions}" SelectedItem="{Binding Language, Mode=TwoWay}"/>
53-
</StackPanel>
54-
</ScrollViewer>
42+
<CheckBox Content="Enable code folding" IsChecked="{Binding IsFoldingEnabled, Mode=TwoWay}" />
43+
<CheckBox Content="Enable text wrapping" IsChecked="{Binding IsWrappingEnabled, Mode=TwoWay}" />
44+
<CheckBox Content="Show line numbers" IsChecked="{Binding ShowLineNumbers, Mode=TwoWay}" />
45+
<CheckBox Content="Show tab/newline markers" IsChecked="{Binding ShowControlCharacters, Mode=TwoWay}" />
46+
<CheckBox Content="Show warning/error markers" IsChecked="{Binding ShowLineMarkers, Mode=TwoWay}" />
47+
<CheckBox Content="Show scrollbar markers" IsChecked="{Binding ShowScrollbarMarkers, Mode=TwoWay}" />
48+
<CheckBox Content="Show horizontal ticks (10 chars)" IsChecked="{Binding ShowHorizontalTicks, Mode=TwoWay}" />
49+
</StackPanel>
50+
</Flyout>
51+
</Button.Flyout>
52+
</Button>
53+
<ComboBox VerticalAlignment="Center" ItemsSource="{Binding LanguageOptions}" SelectedItem="{Binding Language, Mode=TwoWay}"/>
54+
</StackPanel>
55+
</ScrollViewer>
5556

56-
<codewriter:CodeWriter x:Name="CW" Grid.Row="1" Language="{Binding EditorLanguage}" Text="{Binding Text, Mode=TwoWay}" TextChanged="CW_TextChanged" ErrorOccured="CW_ErrorOccured" FontSize="{Binding FontSize, Mode=TwoWay}" TabLength="{Binding TabLength}" RequestedTheme="{Binding RequestedTheme}" ShowControlCharacters="{Binding ShowControlCharacters}" ShowLineNumbers="{Binding ShowLineNumbers}" ShowLineMarkers="{Binding ShowLineMarkers}" IsFoldingEnabled="{Binding IsFoldingEnabled}" ShowScrollbarMarkers="{Binding ShowScrollbarMarkers}" ShowHorizontalTicks="{Binding ShowHorizontalTicks}"/>
57+
<codewriter:CodeWriter x:Name="CW" Grid.Row="1" Language="{Binding EditorLanguage}" Text="{Binding Text, Mode=TwoWay}" TextChanged="CW_TextChanged" ErrorOccured="CW_ErrorOccured" FontSize="{Binding FontSize, Mode=TwoWay}" TabLength="{Binding TabLength}" RequestedTheme="{Binding RequestedTheme}" ShowControlCharacters="{Binding ShowControlCharacters}" ShowLineNumbers="{Binding ShowLineNumbers}" ShowLineMarkers="{Binding ShowLineMarkers}" IsFoldingEnabled="{Binding IsFoldingEnabled}" IsWrappingEnabled="{Binding IsWrappingEnabled}" ShowScrollbarMarkers="{Binding ShowScrollbarMarkers}" ShowHorizontalTicks="{Binding ShowHorizontalTicks}"/>
5758

58-
<Grid Grid.Row="2">
59-
<Grid.RowDefinitions>
60-
<RowDefinition Height="Auto" />
61-
<RowDefinition Height="*" />
62-
</Grid.RowDefinitions>
63-
<TextBlock Margin="12,0,0,0" Grid.Row="0" FontSize="16" Text="Error Log:"></TextBlock>
64-
<ScrollViewer Grid.Row="1" MaxHeight="200" x:Name="LogScroll" VerticalScrollMode="Enabled" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" >
65-
<TextBlock IsTextSelectionEnabled="True" TextWrapping="NoWrap" Text="{Binding Log}"></TextBlock>
66-
</ScrollViewer>
67-
</Grid>
68-
</Grid>
59+
<Grid Grid.Row="2">
60+
<Grid.RowDefinitions>
61+
<RowDefinition Height="Auto" />
62+
<RowDefinition Height="*" />
63+
</Grid.RowDefinitions>
64+
<TextBlock Margin="12,0,0,0" Grid.Row="0" FontSize="16" Text="Error Log:"></TextBlock>
65+
<ScrollViewer Grid.Row="1" MaxHeight="200" x:Name="LogScroll" VerticalScrollMode="Enabled" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" >
66+
<TextBlock IsTextSelectionEnabled="True" TextWrapping="NoWrap" Text="{Binding Log}"></TextBlock>
67+
</ScrollViewer>
68+
</Grid>
69+
</Grid>
6970
</Page>

CodeEditor-WinUI-TestApp/CodeWriter-WinUI-TestApp/ViewModel.cs

+50-50
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,57 @@
66

77
namespace CodeEditor_WinUI_TestApp
88
{
9-
internal class ViewModel : Bindable
9+
internal class ViewModel : Bindable
10+
{
11+
public List<Language> LanguageList = new()
1012
{
11-
public List<Language> LanguageList = new()
13+
Languages.ConTeXt,
14+
new("Lua")
15+
{
16+
FoldingPairs = new()
1217
{
13-
Languages.ConTeXt,
14-
new()
15-
{
16-
Name = "Lua",
17-
FoldingPairs = new()
18-
{
19-
new() { RegexStart = /*language=regex*/ @"\bfunction\b", RegexEnd = /*language=regex*/ @"\bend\b" },
20-
new() { RegexStart = /*language=regex*/ @"\bfor\b", RegexEnd = /*language=regex*/ @"\bend\b" },
21-
new() { RegexStart = /*language=regex*/ @"\bwhile\b", RegexEnd = /*language=regex*/ @"\bend\b" },
22-
new() { RegexStart = /*language=regex*/ @"\bif\b", RegexEnd = /*language=regex*/ @"\bend\b" },
23-
},
24-
RegexTokens = new()
25-
{
26-
{ Token.Math, /*language=regex*/ @"\b(math)\.(pi|a?tan|atan2|tanh|a?cos|cosh|a?sin|sinh|max|pi|min|ceil|floor|(fr|le)?exp|pow|fmod|modf|random(seed)?|sqrt|log(10)?|deg|rad|abs)\b" },
27-
{ Token.Array, /*language=regex*/ @"\b((table)\.(insert|concat|sort|remove|maxn)|(string)\.(insert|sub|rep|reverse|format|len|find|byte|char|dump|lower|upper|g?match|g?sub|format|formatters))\b" },
28-
{ Token.Symbol, /*language=regex*/ @"[:=<>,.!?&%+\|\-*\/\^~;]" },
29-
{ Token.Bracket, /*language=regex*/ @"[\[\]\(\)\{\}]" },
30-
{ Token.Number, /*language=regex*/ @"0[xX][0-9a-fA-F]*|-?\d*\.\d+([eE][\-+]?\d+)?|-?\d+?" },
31-
{ Token.String, /*language=regex*/ "\\\".*?\\\"|'.*?'" },
32-
{ Token.Comment, /*language=regex*/ @"--.*" },
33-
},
34-
WordTokens = new()
35-
{
36-
{ Token.Keyword, new string[] { "local", "true", "false", "in", "else", "not", "or", "and", "then", "nil", "end", "do", "repeat", "goto", "until", "return", "break" } },
37-
{ Token.Environment, new string[] { "function", "end", "if", "elseif", "else", "while", "for", } },
38-
{ Token.Function, new string[] { "#", "assert", "collectgarbage", "dofile", "_G", "getfenv", "ipairs", "load", "loadstring", "pairs", "pcall", "print", "rawequal", "rawget", "rawset", "select", "setfenv", "_VERSION", "xpcall", "module", "require", "tostring", "tonumber", "type", "rawset", "setmetatable", "getmetatable", "error", "unpack", "next", } }
39-
},
40-
}
41-
};
18+
new() { RegexStart = /*language=regex*/ @"\bfunction\b", RegexEnd = /*language=regex*/ @"\bend\b" },
19+
new() { RegexStart = /*language=regex*/ @"\bfor\b", RegexEnd = /*language=regex*/ @"\bend\b" },
20+
new() { RegexStart = /*language=regex*/ @"\bwhile\b", RegexEnd = /*language=regex*/ @"\bend\b" },
21+
new() { RegexStart = /*language=regex*/ @"\bif\b", RegexEnd = /*language=regex*/ @"\bend\b" },
22+
},
23+
RegexTokens = new()
24+
{
25+
{ Token.Math, /*language=regex*/ @"\b(math)\.(pi|a?tan|atan2|tanh|a?cos|cosh|a?sin|sinh|max|pi|min|ceil|floor|(fr|le)?exp|pow|fmod|modf|random(seed)?|sqrt|log(10)?|deg|rad|abs)\b" },
26+
{ Token.Array, /*language=regex*/ @"\b((table)\.(insert|concat|sort|remove|maxn)|(string)\.(insert|sub|rep|reverse|format|len|find|byte|char|dump|lower|upper|g?match|g?sub|format|formatters))\b" },
27+
{ Token.Symbol, /*language=regex*/ @"[:=<>,.!?&%+\|\-*\/\^~;]" },
28+
{ Token.Bracket, /*language=regex*/ @"[\[\]\(\)\{\}]" },
29+
{ Token.Number, /*language=regex*/ @"0[xX][0-9a-fA-F]*|-?\d*\.\d+([eE][\-+]?\d+)?|-?\d+?" },
30+
{ Token.String, /*language=regex*/ "\\\".*?\\\"|'.*?'" },
31+
{ Token.Comment, /*language=regex*/ @"--.*" },
32+
},
33+
WordTokens = new()
34+
{
35+
{ Token.Keyword, new string[] { "local", "true", "false", "in", "else", "not", "or", "and", "then", "nil", "end", "do", "repeat", "goto", "until", "return", "break" } },
36+
{ Token.Environment, new string[] { "function", "end", "if", "elseif", "else", "while", "for", } },
37+
{ Token.Function, new string[] { "#", "assert", "collectgarbage", "dofile", "_G", "getfenv", "ipairs", "load", "loadstring", "pairs", "pcall", "print", "rawequal", "rawget", "rawset", "select", "setfenv", "_VERSION", "xpcall", "module", "require", "tostring", "tonumber", "type", "rawset", "setmetatable", "getmetatable", "error", "unpack", "next", } }
38+
},
39+
}
40+
};
4241

43-
public Language EditorLanguage { get => Get(LanguageList[1]); set { Set(value); } }
44-
public int FontSize { get => Get(20); set => Set(value); }
45-
public bool IsFoldingEnabled { get => Get(true); set => Set(value); }
46-
public string Language { get => Get("Lua"); set { Set(value); EditorLanguage = LanguageList.First(x => x.Name == value); } }
47-
public string[] LanguageOptions => LanguageList.Select(x => x.Name).ToArray();
48-
public string LastSavedText { get => Get(""); set { Set(value); UnsavedChanges = value != Text; } }
49-
public string Log { get => Get(""); set => Set(value); }
50-
public ElementTheme RequestedTheme { get => Get(ElementTheme.Default); set => Set(value); }
51-
public bool ShowControlCharacters { get => Get(true); set => Set(value); }
52-
public bool ShowHorizontalTicks { get => Get(true); set => Set(value); }
53-
public bool ShowLineMarkers { get => Get(true); set => Set(value); }
54-
public bool ShowLineNumbers { get => Get(true); set => Set(value); }
55-
public bool ShowScrollbarMarkers { get => Get(true); set => Set(value); }
56-
public int TabLength { get => Get(2); set => Set(value); }
57-
public string Text { get => Get(""); set { Set(value); UnsavedChanges = value != LastSavedText; } }
58-
public string Theme { get => Get("Default"); set { Set(value); RequestedTheme = (ElementTheme)Enum.Parse(typeof(ElementTheme), value); } }
59-
public string[] ThemeOptions => Enum.GetNames<ElementTheme>();
60-
public bool UnsavedChanges { get => Get(false); set => Set(value); }
61-
}
42+
public Language EditorLanguage { get => Get(LanguageList[1]); set { Set(value); } }
43+
public int FontSize { get => Get(20); set => Set(value); }
44+
public bool IsFoldingEnabled { get => Get(true); set => Set(value); }
45+
public bool IsWrappingEnabled { get => Get(true); set => Set(value); }
46+
public string Language { get => Get("Lua"); set { Set(value); EditorLanguage = LanguageList.First(x => x.Name == value); } }
47+
public string[] LanguageOptions => LanguageList.Select(x => x.Name).ToArray();
48+
public string LastSavedText { get => Get(""); set { Set(value); UnsavedChanges = value != Text; } }
49+
public string Log { get => Get(""); set => Set(value); }
50+
public ElementTheme RequestedTheme { get => Get(ElementTheme.Default); set => Set(value); }
51+
public bool ShowControlCharacters { get => Get(true); set => Set(value); }
52+
public bool ShowHorizontalTicks { get => Get(true); set => Set(value); }
53+
public bool ShowLineMarkers { get => Get(true); set => Set(value); }
54+
public bool ShowLineNumbers { get => Get(true); set => Set(value); }
55+
public bool ShowScrollbarMarkers { get => Get(true); set => Set(value); }
56+
public int TabLength { get => Get(2); set => Set(value); }
57+
public string Text { get => Get(""); set { Set(value); UnsavedChanges = value != LastSavedText; } }
58+
public string Theme { get => Get("Default"); set { Set(value); RequestedTheme = (ElementTheme)Enum.Parse(typeof(ElementTheme), value); } }
59+
public string[] ThemeOptions => Enum.GetNames<ElementTheme>();
60+
public bool UnsavedChanges { get => Get(false); set => Set(value); }
61+
}
6262
}

0 commit comments

Comments
 (0)