diff --git a/src/Views/Controls/TextEdit.cs b/src/Views/Controls/TextEdit.cs index 07266bf3..a6d626ae 100644 --- a/src/Views/Controls/TextEdit.cs +++ b/src/Views/Controls/TextEdit.cs @@ -35,6 +35,24 @@ namespace SourceGit.Views.Controls { SelectionChanged += OnSelectionChanged; } + protected override void OnMouseWheel(MouseWheelEventArgs e) { + base.OnMouseWheel(e); + + if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { + if (e.Delta > 0) { + LineLeft(); + } else { + LineRight(); + } + } else { + if (e.Delta > 0) { + LineUp(); + } else { + LineDown(); + } + } + } + private void OnTextChanged(object sender, TextChangedEventArgs e) { PlaceholderVisibility = string.IsNullOrEmpty(Text) ? Visibility.Visible : Visibility.Collapsed; } diff --git a/src/Views/Widgets/CommitDetail.xaml b/src/Views/Widgets/CommitDetail.xaml index 4f046c6b..d861b293 100644 --- a/src/Views/Widgets/CommitDetail.xaml +++ b/src/Views/Widgets/CommitDetail.xaml @@ -170,7 +170,7 @@ BorderThickness="0" TextWrapping="Wrap" Margin="11,5,16,0" - MaxHeight="80" + MaxHeight="100" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top"/> diff --git a/src/Views/Widgets/CommitDetail.xaml.cs b/src/Views/Widgets/CommitDetail.xaml.cs index 765b6d13..149af56e 100644 --- a/src/Views/Widgets/CommitDetail.xaml.cs +++ b/src/Views/Widgets/CommitDetail.xaml.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using System.Windows.Media; using System.Windows.Navigation; namespace SourceGit.Views.Widgets { @@ -44,6 +45,7 @@ namespace SourceGit.Views.Widgets { private void UpdateInformation(Models.Commit commit) { txtSHA.Text = commit.SHA; txtMessage.Text = (commit.Subject + "\n\n" + commit.Message.Trim()).Trim(); + txtMessage.ScrollToHome(); avatarAuthor.Email = commit.Author.Email; avatarAuthor.FallbackLabel = commit.Author.Name; @@ -90,6 +92,10 @@ namespace SourceGit.Views.Widgets { Dispatcher.Invoke(() => { changeList.ItemsSource = changes; + + ScrollViewer sw = GetVisualChild(changeList); + if (sw != null) sw.ScrollToHome(); + changeContainer.SetData(repo, new List() { commit }, changes); }); }); @@ -189,5 +195,25 @@ namespace SourceGit.Views.Widgets { e.Handled = true; } #endregion + + private T GetVisualChild(DependencyObject parent) where T : Visual { + T child = null; + + int count = VisualTreeHelper.GetChildrenCount(parent); + for (int i = 0; i < count; i++) { + Visual v = (Visual)VisualTreeHelper.GetChild(parent, i); + child = v as T; + + if (child == null) { + child = GetVisualChild(v); + } + + if (child != null) { + break; + } + } + + return child; + } } } diff --git a/src/Views/Widgets/Welcome.xaml b/src/Views/Widgets/Welcome.xaml index 24c916de..c2a99529 100644 --- a/src/Views/Widgets/Welcome.xaml +++ b/src/Views/Widgets/Welcome.xaml @@ -53,10 +53,11 @@ +