diff --git a/src/ViewModels/Blame.cs b/src/ViewModels/Blame.cs index 253626bc..7ee39550 100644 --- a/src/ViewModels/Blame.cs +++ b/src/ViewModels/Blame.cs @@ -57,6 +57,11 @@ namespace SourceGit.ViewModels } } + public Models.Commit GetCommitInfo(string commitSHA) + { + return new Commands.QuerySingleCommit(_repo, commitSHA).Result(); + } + private readonly string _repo; private Models.BlameData _data = null; } diff --git a/src/Views/Blame.axaml b/src/Views/Blame.axaml index b700b580..4d050bb5 100644 --- a/src/Views/Blame.axaml +++ b/src/Views/Blame.axaml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:m="using:SourceGit.Models" xmlns:vm="using:SourceGit.ViewModels" xmlns:v="using:SourceGit.Views" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" @@ -59,8 +60,22 @@ FontFamily="{DynamicResource Fonts.Monospace}" FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorFontSize}" TabWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=EditorTabWidth}" - BlameData="{Binding Data}"/> - + BlameData="{Binding Data}"> + + + + + + + + + + + + + + + + { + var commit = blame.GetCommitInfo(info.CommitSHA); + if (commit == null) + return; + + Dispatcher.UIThread.Invoke(() => + { + if (IsEffectivelyVisible && IsPointerOver) + { + ToolTip.SetTip(this, commit); + ToolTip.SetIsOpen(this, true); + } + }); + }); + } + return; } } - } - Cursor = Cursor.Default; + Cursor = Cursor.Default; + ToolTip.SetIsOpen(this, false); + } } protected override void OnPointerPressed(PointerPressedEventArgs e) @@ -230,9 +257,9 @@ namespace SourceGit.Views private readonly BlameTextEditor _editor = null; } - public class VerticalSeperatorMargin : AbstractMargin + public class VerticalSeparatorMargin : AbstractMargin { - public VerticalSeperatorMargin(BlameTextEditor editor) + public VerticalSeparatorMargin(BlameTextEditor editor) { _editor = editor; } @@ -284,9 +311,9 @@ namespace SourceGit.Views _textMate = Models.TextMateHelper.CreateForEditor(this); TextArea.LeftMargins.Add(new LineNumberMargin() { Margin = new Thickness(8, 0) }); - TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this)); + TextArea.LeftMargins.Add(new VerticalSeparatorMargin(this)); TextArea.LeftMargins.Add(new CommitInfoMargin(this) { Margin = new Thickness(8, 0) }); - TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this)); + TextArea.LeftMargins.Add(new VerticalSeparatorMargin(this)); TextArea.Caret.PositionChanged += OnTextAreaCaretPositionChanged; TextArea.LayoutUpdated += OnTextAreaLayoutUpdated; TextArea.PointerWheelChanged += OnTextAreaPointerWheelChanged; diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 630be1b2..925c7622 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -60,7 +60,7 @@ namespace SourceGit.Views public class ThemedTextDiffPresenter : TextEditor { - public class VerticalSeperatorMargin : AbstractMargin + public class VerticalSeparatorMargin : AbstractMargin { public override void Render(DrawingContext context) { @@ -1085,9 +1085,9 @@ namespace SourceGit.Views public CombinedTextDiffPresenter() : base(new TextArea(), new TextDocument()) { TextArea.LeftMargins.Add(new LineNumberMargin(false, true)); - TextArea.LeftMargins.Add(new VerticalSeperatorMargin()); + TextArea.LeftMargins.Add(new VerticalSeparatorMargin()); TextArea.LeftMargins.Add(new LineNumberMargin(false, false)); - TextArea.LeftMargins.Add(new VerticalSeperatorMargin()); + TextArea.LeftMargins.Add(new VerticalSeparatorMargin()); TextArea.LeftMargins.Add(new LineModifyTypeMargin()); } @@ -1286,7 +1286,7 @@ namespace SourceGit.Views public SingleSideTextDiffPresenter() : base(new TextArea(), new TextDocument()) { TextArea.LeftMargins.Add(new LineNumberMargin(true, false)); - TextArea.LeftMargins.Add(new VerticalSeperatorMargin()); + TextArea.LeftMargins.Add(new VerticalSeparatorMargin()); TextArea.LeftMargins.Add(new LineModifyTypeMargin()); }