From 0e36c854c6959a99289f4197555ee4912f28a6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fele?= Date: Wed, 1 Nov 2023 00:00:49 +0100 Subject: [PATCH 01/13] Simple ScrollBarStyles.xaml --- src/ChatPrisma/App.xaml | 1 + src/ChatPrisma/Themes/ScrollBarStyles.xaml | 38 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/ChatPrisma/Themes/ScrollBarStyles.xaml diff --git a/src/ChatPrisma/App.xaml b/src/ChatPrisma/App.xaml index 624b4c5..e23678a 100644 --- a/src/ChatPrisma/App.xaml +++ b/src/ChatPrisma/App.xaml @@ -15,6 +15,7 @@ + diff --git a/src/ChatPrisma/Themes/ScrollBarStyles.xaml b/src/ChatPrisma/Themes/ScrollBarStyles.xaml new file mode 100644 index 0000000..1b1a424 --- /dev/null +++ b/src/ChatPrisma/Themes/ScrollBarStyles.xaml @@ -0,0 +1,38 @@ + + + + \ No newline at end of file From 2344a0619ae0235c7779765e1060500175f99e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fele?= Date: Wed, 1 Nov 2023 00:01:03 +0100 Subject: [PATCH 02/13] Ensure we are always scrolled to the bottom when we start with a long text --- .../TextEnhancement/TextEnhancementView.xaml.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ChatPrisma/Views/TextEnhancement/TextEnhancementView.xaml.cs b/src/ChatPrisma/Views/TextEnhancement/TextEnhancementView.xaml.cs index ae9bb1f..d9b9b92 100644 --- a/src/ChatPrisma/Views/TextEnhancement/TextEnhancementView.xaml.cs +++ b/src/ChatPrisma/Views/TextEnhancement/TextEnhancementView.xaml.cs @@ -11,9 +11,13 @@ private void TextEnhancementView_OnLoaded(object sender, RoutedEventArgs e) { this.InstructionTextBox.Focus(); - // Place window slightly to the top var window = Window.GetWindow(this)!; - window.Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => + + // Ensure we are scrolled to the bottom + window.Dispatcher.BeginInvoke(DispatcherPriority.Render, this.ScrollToBottom); + + // Place window slightly to the top + window.Dispatcher.BeginInvoke(DispatcherPriority.Render, () => { var helper = new WindowInteropHelper(window); var currentScreen = Screen.FromHandle(helper.Handle); @@ -21,7 +25,7 @@ private void TextEnhancementView_OnLoaded(object sender, RoutedEventArgs e) // Place the window a bit moved to the top, so it is perfectly centered if we reach this.MaxHeight window.Top = Math.Max((currentScreenHeight - this.MaxHeight) / 2, 0); - })); + }); // Ensure window is shown above all other windows window.Activate(); @@ -52,6 +56,11 @@ private void ViewModelOnApplyInstructionCancelled(object? sender, EventArgs e) private void TextTextBlock_OnSizeChanged(object sender, SizeChangedEventArgs e) { // Keep the ScrollViewer scrolled to the bottom while the text is generating + this.ScrollToBottom(); + } + + private void ScrollToBottom() + { this.TextScrollViewer.ScrollToVerticalOffset(this.TextScrollViewer.ExtentHeight); } } From 2cbd450b4c513c6269b521c9eb2ddbf5576dd817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fele?= Date: Fri, 10 Nov 2023 19:39:08 +0100 Subject: [PATCH 03/13] Fix height of close window button --- src/ChatPrisma/Themes/WindowStyles.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ChatPrisma/Themes/WindowStyles.xaml b/src/ChatPrisma/Themes/WindowStyles.xaml index a6eb8bc..d589d4f 100644 --- a/src/ChatPrisma/Themes/WindowStyles.xaml +++ b/src/ChatPrisma/Themes/WindowStyles.xaml @@ -183,6 +183,7 @@