Skip to content

A Swiss Army knife for developers.

Displays the details of the Match object returned by the Regex call.… (#627)

James Curran623fe57ceca8
diff --git a/src/dev/DevToys.Startup/Package.appxmanifest b/src/dev/DevToys.Startup/Package.appxmanifest
index 3bec99355..c4d57e3f1 100644
--- a/src/dev/DevToys.Startup/Package.appxmanifest
+++ b/src/dev/DevToys.Startup/Package.appxmanifest
@@ -15,7 +15,7 @@
<Identity
Name="DevToysPreview"
Publisher="CN=etiennebaudoux"
- Version="0.0.0.0" />
+ Version="1.0.9.0" />
<Properties>
<DisplayName>DevToys - Preview</DisplayName>
diff --git a/src/dev/impl/DevToys/Core/Collections/ExtendedObservableCollection.cs b/src/dev/impl/DevToys/Core/Collections/ExtendedObservableCollection.cs
index 6e54bc466..f24deec20 100644
--- a/src/dev/impl/DevToys/Core/Collections/ExtendedObservableCollection.cs
+++ b/src/dev/impl/DevToys/Core/Collections/ExtendedObservableCollection.cs
@@ -48,7 +48,7 @@ namespace DevToys.Core.Collections
foreach (T? item in newItems)
{
int indexOfItemInOldMenu = IndexOf(item);
- if (indexOfItemInOldMenu > -1)
+ if (indexOfItemInOldMenu > -1 && insertionIndex < Count)
{
if (indexOfItemInOldMenu != insertionIndex)
{
diff --git a/src/dev/impl/DevToys/LanguageManager.cs b/src/dev/impl/DevToys/LanguageManager.cs
index 34fcb706a..acbfc2baa 100644
--- a/src/dev/impl/DevToys/LanguageManager.cs
+++ b/src/dev/impl/DevToys/LanguageManager.cs
@@ -2417,6 +2417,16 @@ namespace DevToys
/// Gets the resource SearchKeywords.
/// </summary>
public string SearchKeywords => _resources.GetString("SearchKeywords");
+
+ /// <summary>
+ /// Gets the resource InputTitle.
+ /// </summary>
+ public string InputTitle => _resources.GetString("InputTitle");
+
+ /// <summary>
+ /// Gets the resource OutputTitle.
+ /// </summary>
+ public string OutputTitle => _resources.GetString("OutputTitle");
}
public class SearchResultStrings : ObservableObject
diff --git a/src/dev/impl/DevToys/Strings/en-US/RegEx.resw b/src/dev/impl/DevToys/Strings/en-US/RegEx.resw
index 65e6f9bf4..7292dac88 100644
--- a/src/dev/impl/DevToys/Strings/en-US/RegEx.resw
+++ b/src/dev/impl/DevToys/Strings/en-US/RegEx.resw
@@ -186,4 +186,10 @@
<data name="SearchKeywords" xml:space="preserve">
<value>Regular expression</value>
</data>
+ <data name="InputTitle" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="OutputTitle" xml:space="preserve">
+ <value>Output</value>
+ </data>
</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/UI/Controls/CustomTextBox.xaml.cs b/src/dev/impl/DevToys/UI/Controls/CustomTextBox.xaml.cs
index d87c9cdf1..e81e02445 100644
--- a/src/dev/impl/DevToys/UI/Controls/CustomTextBox.xaml.cs
+++ b/src/dev/impl/DevToys/UI/Controls/CustomTextBox.xaml.cs
@@ -8,6 +8,7 @@ using DevToys.Api.Core.Settings;
using DevToys.Core;
using DevToys.Core.Settings;
using DevToys.Core.Threading;
+using DevToys.MonacoEditor.Monaco;
using Microsoft.Toolkit.Mvvm.Input;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
@@ -16,6 +17,7 @@ using Windows.UI;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media;
using Clipboard = Windows.ApplicationModel.DataTransfer.Clipboard;
@@ -315,9 +317,6 @@ namespace DevToys.UI.Controls
public void SetHighlights(IEnumerable<HighlightSpan>? spans)
{
- IEnumerable<HighlightSpan>? highlightsToRemove = _highlightedSpans?.Except(spans ?? Array.Empty<HighlightSpan>());
- IEnumerable<HighlightSpan>? highlightsToAdd = spans?.Except(_highlightedSpans ?? Array.Empty<HighlightSpan>());
-
_highlightedSpans = spans;
if (!IsRichTextEdit)
@@ -328,31 +327,49 @@ namespace DevToys.UI.Controls
RichEditBox? richEditBox = GetRichEditBox();
richEditBox.TextDocument.BatchDisplayUpdates();
- if (highlightsToRemove is not null)
+ if (spans is not null && spans.Any())
{
- foreach (HighlightSpan span in highlightsToRemove)
+ HighlightSpan[] spansArray = spans.ToArray();
+ int clearFormattingStartIndex = 0;
+ for (int i = 0; i < spansArray.Length; i++)
{
+ HighlightSpan span = spansArray[i];
ITextRange range
= richEditBox.TextDocument.GetRange(
span.StartIndex,
span.StartIndex + span.Length);
- range.CharacterFormat.BackgroundColor = Colors.Transparent;
- range.CharacterFormat.ForegroundColor = ActualTheme == ElementTheme.Dark ? Colors.White : Colors.Black;
+ range.CharacterFormat.BackgroundColor = span.BackgroundColor;
+ range.CharacterFormat.ForegroundColor = span.ForegroundColor;
+
+ if (span.StartIndex - clearFormattingStartIndex > 0)
+ {
+ range
+ = richEditBox.TextDocument.GetRange(
+ clearFormattingStartIndex,
+ span.StartIndex);
+ range.CharacterFormat.BackgroundColor = Colors.Transparent;
+ range.CharacterFormat.ForegroundColor = ActualTheme == ElementTheme.Dark ? Colors.White : Colors.Black;
+ }
+
+ clearFormattingStartIndex = span.StartIndex + span.Length;
}
- }
- if (highlightsToAdd is not null)
- {
- foreach (HighlightSpan span in highlightsToAdd)
+ if (Text.Length - clearFormattingStartIndex > 0)
{
ITextRange range
- = richEditBox.TextDocument.GetRange(
- span.StartIndex,
- span.StartIndex + span.Length);
- range.CharacterFormat.BackgroundColor = span.BackgroundColor;
- range.CharacterFormat.ForegroundColor = span.ForegroundColor;
+ = richEditBox.TextDocument.GetRange(
+ clearFormattingStartIndex,
+ Text.Length);
+ range.CharacterFormat.BackgroundColor = Colors.Transparent;
+ range.CharacterFormat.ForegroundColor = ActualTheme == ElementTheme.Dark ? Colors.White : Colors.Black;
}
}
+ else
+ {
+ ITextRange range = richEditBox.TextDocument.GetRange(0, Text.Length);
+ range.CharacterFormat.BackgroundColor = Colors.Transparent;
+ range.CharacterFormat.ForegroundColor = ActualTheme == ElementTheme.Dark ? Colors.White : Colors.Black;
+ }
richEditBox.TextDocument.ApplyDisplayUpdates();
}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Text/RegEx/RegExToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Text/RegEx/RegExToolViewModel.cs
index 1acad443b..350a7d782 100644
--- a/src/dev/impl/DevToys/ViewModels/Tools/Text/RegEx/RegExToolViewModel.cs
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Text/RegEx/RegExToolViewModel.cs
@@ -3,11 +3,13 @@
using System;
using System.Collections.Generic;
using System.Composition;
+using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using DevToys.Api.Core;
using DevToys.Api.Core.Settings;
using DevToys.Api.Tools;
+using DevToys.Core.Collections;
using DevToys.Core.Threading;
using DevToys.Shared.Core.Threading;
using DevToys.UI.Controls;
@@ -196,6 +198,40 @@ namespace DevToys.ViewModels.Tools.RegEx
}
}
+ private string? _errorMsg;
+ internal string? ErrorMsg
+ {
+ get => _errorMsg;
+ set
+ {
+ SetProperty(ref _errorMsg, value);
+ }
+ }
+
+ internal ExtendedObservableCollection<MatchDetails2> MatchGroups { get; } = new();
+
+ private string? _inputValue;
+ internal string? InputValue
+ {
+ get => _inputValue;
+ set
+ {
+ SetProperty(ref _inputValue, value);
+ QueueRegExMatch();
+ }
+ }
+
+ private string? _outputValue;
+ internal string? OutputValue
+ {
+ get => _outputValue;
+ set
+ {
+ SetProperty(ref _outputValue, value);
+ QueueRegExMatch();
+ }
+ }
+
internal ICustomTextBox? MatchTextBox { private get; set; }
[ImportingConstructor]
@@ -225,52 +261,86 @@ namespace DevToys.ViewModels.Tools.RegEx
await ThreadHelper.RunOnUIThreadAsync(() =>
{
ElementTheme currentTheme = ((Frame)Window.Current.Content).ActualTheme;
- string? highlighterBackgroundResourceName = currentTheme == ElementTheme.Light ? "SystemAccentColorLight2" : "SystemAccentColorDark1";
+ string? highlighterBackgroundResourceName = currentTheme == ElementTheme.Light
+ ? "SystemAccentColorLight2"
+ : "SystemAccentColorDark1";
highlighterForegroundColor = currentTheme == ElementTheme.Light ? Colors.Black : Colors.White;
highlighterBackgroundColor = (Color)Application.Current.Resources[highlighterBackgroundResourceName];
});
await TaskScheduler.Default;
-
+ string errorMsg = "";
while (_regExMatchingQueue.TryDequeue(out (string pattern, string text) data))
{
var spans = new List<HighlightSpan>();
-
- try
+ MatchCollection? matches = null;
+ Regex? regex = null;
+ if (!String.IsNullOrWhiteSpace(data.pattern))
{
- string? pattern = data.pattern.Trim('/');
-
- var regex = new Regex(data.pattern, GetOptions());
- MatchCollection matches = regex.Matches(data.text);
-
- foreach (Match match in matches)
+ try
{
- int lineCount = CountLines(data.text, match.Index);
- spans.Add(
- new HighlightSpan()
- {
- StartIndex = match.Index - lineCount,
- Length = match.Length,
- BackgroundColor = highlighterBackgroundColor,
- ForegroundColor = highlighterForegroundColor
- });
+ string? pattern = data.pattern.Trim('/');
+ regex = new Regex(data.pattern, GetOptions());
+ matches = regex.Matches(data.text);
+ foreach (Match match in matches)
+ {
+ int lineCount = CountLines(data.text, match.Index);
+ spans.Add(
+ new HighlightSpan()
+ {
+ StartIndex = match.Index - lineCount,
+ Length = match.Length,
+ BackgroundColor = highlighterBackgroundColor,
+ ForegroundColor = highlighterForegroundColor
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ errorMsg = ex.Message;
+ // TODO: indicate the user that the regex is wrong.
}
- }
- catch
- {
- // TODO: indicate the user that the regex is wrong.
}
ThreadHelper.RunOnUIThreadAsync(
ThreadPriority.Low,
() =>
{
- MatchTextBox?.SetHighlights(spans);
+ ErrorMsg = errorMsg;
+ if (matches != null)
+ {
+ MatchTextBox?.SetHighlights(spans);
+
+ IEnumerable<MatchDetails2> matchesGroups
+ = matches
+ .Cast<Match>()
+ .SelectMany(
+ (c, inx) => c.Groups
+ .Cast<Group>()
+ .OrderBy(g => g.Index)
+ .Select(mm => new MatchDetails2
+ {
+ Title = (mm.Name == "0" ? $"Match {inx + 1}:" : $" Group \"{mm.Name}\""),
+ Range = $"{mm.Index}-{mm.Index + mm.Length}",
+ Value = mm.Value
+ }));
+ MatchGroups.Update(matchesGroups);
+
+ if (InputValue != null)
+ {
+ OutputValue = regex?.Replace(data.text, InputValue);
+ }
- if (spans.Count > 0 && !_toolSuccessfullyWorked)
+ if (spans.Count > 0 && !_toolSuccessfullyWorked)
+ {
+ _toolSuccessfullyWorked = true;
+ _marketingService.NotifyToolSuccessfullyWorked();
+ }
+ }
+ else
{
- _toolSuccessfullyWorked = true;
- _marketingService.NotifyToolSuccessfullyWorked();
+ MatchGroups.Clear();
+ MatchTextBox?.SetHighlights(null);
}
}).ForgetSafely();
}
@@ -315,6 +385,11 @@ namespace DevToys.ViewModels.Tools.RegEx
private int CountLines(string input, int maxLength)
{
+ if (string.IsNullOrEmpty(input))
+ {
+ return 0;
+ }
+
int lines = 0;
int i = 0;
while (i > -1 && i < maxLength)
@@ -330,4 +405,11 @@ namespace DevToys.ViewModels.Tools.RegEx
return lines;
}
}
+
+ public record MatchDetails2
+ {
+ public string Title { get; set; }
+ public string Range { get; set; }
+ public string Value { get; set; }
+ }
}
diff --git a/src/dev/impl/DevToys/Views/Tools/Text/RegEx/RegExToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Text/RegEx/RegExToolPage.xaml
index b66d2512c..c53bc3b4a 100644
--- a/src/dev/impl/DevToys/Views/Tools/Text/RegEx/RegExToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/Text/RegEx/RegExToolPage.xaml
@@ -4,94 +4,106 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:controls="using:DevToys.UI.Controls" xmlns:converters="using:DevToys.UI.Converters"
- mc:Ignorable="d"
- NavigationCacheMode="Required">
+ xmlns:controls="using:DevToys.UI.Controls"
+ xmlns:converters="using:DevToys.UI.Converters"
+ xmlns:regEx="using:DevToys.ViewModels.Tools.RegEx"
+ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
+ NavigationCacheMode="Required"
+ mc:Ignorable="d">
<Page.Resources>
- <converters:InvertedBooleanConverter x:Key="InvertedBooleanConverter"/>
+ <converters:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
+ <converters:NullToBooleanConverter x:Key="StringNullOrWhiteSpaceToFalseConverter" IsInverted="True" EnforceNonWhiteSpaceString="True" />
+
+ <Style x:Key="TextBlockMatchRangeStyle" TargetType="TextBlock">
+ <Setter Property="TextWrapping" Value="Wrap" />
+ <Setter Property="FontSize" Value="12" />
+ <Setter Property="Opacity" Value="0.75" />
+ </Style>
+ <Style x:Key="CardStyle" TargetType="Grid">
+ <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />
+ <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" />
+ <Setter Property="Padding" Value="{StaticResource ExpanderContentPadding}" />
+ <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}"/>
+ <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}"/>
+ </Style>
</Page.Resources>
<Grid Margin="0,0,0,16" RowSpacing="12">
<Grid.ChildrenTransitions>
<TransitionCollection>
- <EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="50"/>
+ <EntranceThemeTransition FromVerticalOffset="50" IsStaggeringEnabled="True" />
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
- <StackPanel Grid.Row="0" Spacing="4" >
- <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
+ <StackPanel Grid.Row="0" Spacing="4">
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind Path=ViewModel.Strings.Configuration}" />
- <controls:ExpandableSettingControl
- Title="{x:Bind ViewModel.Strings.Options}">
+ <controls:ExpandableSettingControl Title="{x:Bind Path=ViewModel.Strings.Options}">
<controls:ExpandableSettingControl.Icon>
<FontIcon Glyph="&#xF6A9;" />
</controls:ExpandableSettingControl.Icon>
<controls:ExpandableSettingControl.ExpandableContent>
- <StackPanel Spacing="0" HorizontalAlignment="Stretch">
+ <StackPanel HorizontalAlignment="Stretch" Spacing="0">
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.EcmaScript}"
CornerRadius="0,0,4,4"
- Title="{x:Bind ViewModel.Strings.EcmaScript}"
- Description="{x:Bind ViewModel.Strings.EcmaScriptDescription}">
- <ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.EcmaScript, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Description="{x:Bind Path=ViewModel.Strings.EcmaScriptDescription}">
+ <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EcmaScript, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.CultureInvariant}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.CultureInvariant}"
- Description="{x:Bind ViewModel.Strings.CultureInvariantDescription}">
- <ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.CultureInvariant, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Description="{x:Bind Path=ViewModel.Strings.CultureInvariantDescription}">
+ <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.CultureInvariant, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.IgnoreCase}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.IgnoreCase}"
- Description="{x:Bind ViewModel.Strings.IgnoreCaseDescription}">
- <ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.IgnoreCase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Description="{x:Bind Path=ViewModel.Strings.IgnoreCaseDescription}">
+ <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreCase, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.IgnoreWhitespace}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.IgnoreWhitespace}"
- Description="{x:Bind ViewModel.Strings.IgnoreWhitespaceDescription}">
+ Description="{x:Bind Path=ViewModel.Strings.IgnoreWhitespaceDescription}">
<ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.IgnoreWhitespace, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- IsEnabled="{x:Bind ViewModel.EcmaScript, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"/>
+ IsEnabled="{x:Bind Converter={StaticResource InvertedBooleanConverter}, Mode=OneWay, Path=ViewModel.EcmaScript}"
+ IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IgnoreWhitespace, UpdateSourceTrigger=PropertyChanged}"
+ Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.Singleline}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.Singleline}"
- Description="{x:Bind ViewModel.Strings.SinglelineDescription}">
+ Description="{x:Bind Path=ViewModel.Strings.SinglelineDescription}">
<ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.Singleline, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- IsEnabled="{x:Bind ViewModel.EcmaScript, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"/>
+ IsEnabled="{x:Bind Converter={StaticResource InvertedBooleanConverter}, Mode=OneWay, Path=ViewModel.EcmaScript}"
+ IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.Singleline, UpdateSourceTrigger=PropertyChanged}"
+ Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.Multiline}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.Multiline}"
- Description="{x:Bind ViewModel.Strings.MultilineDescription}">
- <ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.Multiline, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Description="{x:Bind Path=ViewModel.Strings.MultilineDescription}">
+ <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.Multiline, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
+ Title="{x:Bind Path=ViewModel.Strings.RightToLeft}"
CornerRadius="0"
- Title="{x:Bind ViewModel.Strings.RightToLeft}"
- Description="{x:Bind ViewModel.Strings.RightToLeftDescription}">
+ Description="{x:Bind Path=ViewModel.Strings.RightToLeftDescription}">
<ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.RightToLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- IsEnabled="{x:Bind ViewModel.EcmaScript, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"/>
+ IsEnabled="{x:Bind Converter={StaticResource InvertedBooleanConverter}, Mode=OneWay, Path=ViewModel.EcmaScript}"
+ IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.RightToLeft, UpdateSourceTrigger=PropertyChanged}"
+ Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</controls:ExpandableSettingControl>
</StackPanel>
</controls:ExpandableSettingControl.ExpandableContent>
@@ -100,16 +112,48 @@
<controls:CustomTextBox
Grid.Row="1"
- Header="{x:Bind ViewModel.Strings.RegularExpression}"
- Text="{x:Bind ViewModel.RegularExpression, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Header="{x:Bind Path=ViewModel.Strings.RegularExpression}"
+ Text="{x:Bind Mode=TwoWay, Path=ViewModel.RegularExpression, UpdateSourceTrigger=PropertyChanged}" />
+
+ <muxc:InfoBar
+ Grid.Row="2"
+ Severity="Error"
+ Message="{x:Bind Path=ViewModel.ErrorMsg, Mode=OneWay}"
+ IsOpen="{x:Bind Path=ViewModel.ErrorMsg, Mode=OneWay, Converter={StaticResource StringNullOrWhiteSpaceToFalseConverter}}"
+ IsClosable="False"/>
<controls:CustomTextBox
x:Name="MatchTextBox"
- Grid.Row="2"
- Header="{x:Bind ViewModel.Strings.Text}"
+ Grid.Row="3"
+ MinHeight="150"
AcceptsReturn="True"
+ Header="{x:Bind Path=ViewModel.Strings.Text}"
IsRichTextEdit="True"
- MinHeight="150"
- Text="{x:Bind ViewModel.Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ Text="{x:Bind Mode=TwoWay, Path=ViewModel.Text, UpdateSourceTrigger=PropertyChanged}" />
+
+ <StackPanel Grid.Row="4" Spacing="4">
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="Matches" />
+
+ <Grid
+ Grid.Row="4"
+ Style="{StaticResource CardStyle}">
+ <ListView ItemsSource="{x:Bind ViewModel.MatchGroups, Mode=OneWay}">
+ <ListView.ItemTemplate>
+ <DataTemplate x:DataType="regEx:MatchDetails2">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" MinWidth="200"/>
+ <ColumnDefinition Width="Auto" MinWidth="70"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <TextBlock Text="{x:Bind Title}"/>
+ <TextBlock Grid.Column="1" Style="{StaticResource TextBlockMatchRangeStyle}" Text="{x:Bind Range}"/>
+ <TextBlock Grid.Column="2" Text="{x:Bind Value}"/>
+ </Grid>
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ </Grid>
+ </StackPanel>
</Grid>
-</Page>
+</Page>
\ No newline at end of file
diff --git a/src/dev/shared/SharedAssemblyInfo.cs b/src/dev/shared/SharedAssemblyInfo.cs
index 10b703abb..198401494 100644
--- a/src/dev/shared/SharedAssemblyInfo.cs
+++ b/src/dev/shared/SharedAssemblyInfo.cs
@@ -37,7 +37,7 @@ using System.Runtime.CompilerServices;
// Please DO NOT commit changes on the 2 lines below unless
// you're about to release a new version of the app on the Store.
-[assembly: AssemblyVersion("0.0.0.0")]
-[assembly: AssemblyFileVersion("0.0.0.0")]
+[assembly: AssemblyVersion("1.0.9.0")]
+[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly: InternalsVisibleTo("DevToys.Tests")]