refactor: commit sha link in message (#382)

* remove the built-in commit issue tracker rule
* hyperlink in commit message now supports commit sha
This commit is contained in:
leo 2024-08-21 12:46:36 +08:00
parent 6485a6f93a
commit 191763e1d8
No known key found for this signature in database
11 changed files with 113 additions and 90 deletions

31
src/Models/Hyperlink.cs Normal file
View file

@ -0,0 +1,31 @@
using Avalonia.Controls.Documents;
namespace SourceGit.Models
{
public class Hyperlink
{
public int Start { get; set; } = 0;
public int Length { get; set; } = 0;
public string Link { get; set; } = "";
public bool IsCommitSHA { get; set; } = false;
public Hyperlink(int start, int length, string link, bool isCommitSHA = false)
{
Start = start;
Length = length;
Link = link;
IsCommitSHA = isCommitSHA;
}
public bool Intersect(int start, int length)
{
if (start == Start)
return true;
if (start < Start)
return start + length > Start;
return start < Start + Length;
}
}
}