mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-23 03:14:59 +00:00
Enable tooltips for the commit hashes when handling conflicts
Now you cna hover over the commit hash to see a tooltip like you can for the parent hash in the commit information window
This commit is contained in:
parent
e3cc987682
commit
09309ce86a
3 changed files with 72 additions and 2 deletions
|
@ -1,7 +1,10 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -123,6 +126,36 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnSHAPointerEntered(object sender, PointerEventArgs e)
|
||||
{
|
||||
var repoView = this.FindAncestorOfType<Repository>();
|
||||
if (repoView is { DataContext: ViewModels.Repository repo } && sender is TextBlock text)
|
||||
{
|
||||
var commit = repo.GetCommitInfo(text.Text);
|
||||
|
||||
if (sender is Control control)
|
||||
{
|
||||
var tooltip = ToolTip.GetTip(control);
|
||||
if (tooltip is Models.Commit tip_commit && tip_commit.SHA == commit.SHA)
|
||||
return;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
if (control.IsEffectivelyVisible && control.IsPointerOver)
|
||||
{
|
||||
ToolTip.SetTip(control, commit);
|
||||
ToolTip.SetIsOpen(control, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnUnstageSelectedButtonClicked(object _, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.WorkingCopy vm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue