enhance: show commit full message tooltip when hover commit subject in FileHistories view (#1232)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-23 10:33:49 +08:00
parent 7890f7abbf
commit fafa2a53ae
No known key found for this signature in database
3 changed files with 37 additions and 1 deletions

View file

@ -1,3 +1,5 @@
using System;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
@ -57,5 +59,22 @@ namespace SourceGit.Views
e.Handled = true;
}
}
private void OnCommitSubjectDataContextChanged(object sender, EventArgs e)
{
if (sender is TextBlock textBlock)
ToolTip.SetTip(textBlock, null);
}
private void OnCommitSubjectPointerMoved(object sender, PointerEventArgs e)
{
if (sender is TextBlock { DataContext: Models.Commit commit } textBlock &&
DataContext is ViewModels.FileHistories vm)
{
var tooltip = ToolTip.GetTip(textBlock);
if (tooltip == null)
ToolTip.SetTip(textBlock, vm.GetCommitFullMessage(commit));
}
}
}
}