mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-22 10:55:00 +00:00
code_review: PR #1402
- it's unnecessary to implement `IEnumerable` interface - we should check `IsIntersecting` before creating `InlineElement` to avoid unnecessary works suck as running `git cat-file -t <hash>` - sort whold list after all elements have been added to avoid unnecessary memmove in `Insert` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
fe54d30b70
commit
84fb39f97a
7 changed files with 52 additions and 88 deletions
|
@ -48,8 +48,9 @@ namespace SourceGit.Views
|
|||
|
||||
var inlines = new List<Inline>();
|
||||
var pos = 0;
|
||||
foreach (var link in links)
|
||||
for (var i = 0; i < links.Count; i++)
|
||||
{
|
||||
var link = links[i];
|
||||
if (link.Start > pos)
|
||||
inlines.Add(new Run(message.Substring(pos, link.Start - pos)));
|
||||
|
||||
|
@ -95,8 +96,7 @@ namespace SourceGit.Views
|
|||
point = new Point(x, y);
|
||||
|
||||
var pos = TextLayout.HitTestPoint(point).TextPosition;
|
||||
|
||||
if (links.Lookup(pos) is { } link)
|
||||
if (links.Intersect(pos, 1) is { } link)
|
||||
SetHoveredIssueLink(link);
|
||||
else
|
||||
ClearHoveredIssueLink();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue