From 034138f7debbc4c21f552f915b36af49675bfd94 Mon Sep 17 00:00:00 2001 From: Jonas Arnold Date: Wed, 24 May 2023 19:13:26 +0200 Subject: [PATCH] fixed bug with wrong colors in MultiFormatTextBox, fixed scrolling in history list view --- .../MultiFormatTextBox/MultiFormatTextBox.cs | 9 +++++++-- MultiTerm.Wpf/View/ShellView.xaml | 14 ++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs b/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs index 2f5c88a..62590ee 100644 --- a/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs +++ b/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -229,7 +228,7 @@ public class MultiFormatTextBox : Control // text as run with correct background brush run = new Run(formattedCharacter.Character) { - Background = this.currentlySelectedFormat!.BackgroundBrush + Background = this.GetBackgroundBrushForFormat(formattedCharacter.Format) }; } else if(item is SpacingCharacter spacingCharacter) @@ -410,4 +409,10 @@ public class MultiFormatTextBox : Control this.richTextBox!.Selection.Select(this.richTextBox.Selection.End, this.richTextBox.Selection.End); } } + + private Brush GetBackgroundBrushForFormat(FormatType format) + { + var formatObj = formats.Where(f => f.AssociatedFormatType == format).First(); + return formatObj.BackgroundBrush; + } } diff --git a/MultiTerm.Wpf/View/ShellView.xaml b/MultiTerm.Wpf/View/ShellView.xaml index 26632d8..913ce41 100644 --- a/MultiTerm.Wpf/View/ShellView.xaml +++ b/MultiTerm.Wpf/View/ShellView.xaml @@ -137,13 +137,15 @@ - - + + - + ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.CanContentScroll="True">