fix: ignore all whitespace before real content when calculate subject/total message length

This commit is contained in:
leo 2024-06-24 20:40:47 +08:00
parent 885dccb52b
commit 3b7545e4fb
No known key found for this signature in database
2 changed files with 38 additions and 18 deletions

View file

@ -15,7 +15,7 @@
<Grid RowDefinitions="*,Auto">
<Grid Grid.Row="0">
<Rectangle x:Name="SubjectGuideLine"
Height="1"
Height="0.8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
IsHitTestVisible="False"
@ -24,7 +24,7 @@
<ae:TextEditor x:Name="TextEditor"
Foreground="{DynamicResource Brush.FG1}"
Background="Transparent"
Padding="2,1"
Padding="4"
BorderThickness="0"
WordWrap="True"
Document="{Binding #ThisControl.Document}"
@ -35,7 +35,7 @@
Foreground="{DynamicResource Brush.FG2}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="2,1"
Margin="3"
IsVisible="{Binding #ThisControl.Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
IsHitTestVisible="False"/>
</Grid>
@ -54,7 +54,7 @@
<TextBlock Classes="monospace" FontSize="11" Text="{Binding Source={x:Static vm:Preference.Instance}, Path=SubjectGuideLength}"/>
<Path Width="10" Height="10" Margin="4,0,0,0" Data="{StaticResource Icons.Error}" Fill="DarkGoldenrod" IsVisible="{Binding #ThisControl.SubjectLength, Converter={x:Static c:IntConverters.IsSubjectLengthBad}}"/>
<TextBlock Margin="8,0,0,0" Text="Total:" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Classes="monospace" Margin="2,0,0,0" FontSize="11" Text="{Binding #ThisControl.Text.Length}"/>
<TextBlock Classes="monospace" Margin="2,0,0,0" FontSize="11" Text="{Binding #ThisControl.TotalLength}"/>
</StackPanel>
</Grid>
</Border>