mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 02:12:25 +08:00
enhance: add inlines once time and mark text layout dirty (#400)
This commit is contained in:
@@ -89,21 +89,25 @@ namespace SourceGit.Views
|
||||
matches.Sort((l, r) => l.Start - r.Start);
|
||||
_matches = matches;
|
||||
|
||||
int pos = 0;
|
||||
var inlines = new List<Run>();
|
||||
var pos = 0;
|
||||
foreach (var match in matches)
|
||||
{
|
||||
if (match.Start > pos)
|
||||
Inlines.Add(new Run(message.Substring(pos, match.Start - pos)));
|
||||
inlines.Add(new Run(message.Substring(pos, match.Start - pos)));
|
||||
|
||||
var link = new Run(message.Substring(match.Start, match.Length));
|
||||
link.Classes.Add(match.IsCommitSHA ? "commit_link" : "issue_link");
|
||||
Inlines.Add(link);
|
||||
inlines.Add(link);
|
||||
|
||||
pos = match.Start + match.Length;
|
||||
}
|
||||
|
||||
if (pos < message.Length)
|
||||
Inlines.Add(new Run(message.Substring(pos)));
|
||||
inlines.Add(new Run(message.Substring(pos)));
|
||||
|
||||
Inlines.AddRange(inlines);
|
||||
InvalidateTextLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,22 +212,24 @@ namespace SourceGit.Views
|
||||
matches.Sort((l, r) => l.Start - r.Start);
|
||||
_matches = matches;
|
||||
|
||||
int pos = 0;
|
||||
var inlines = new List<Run>();
|
||||
var pos = 0;
|
||||
foreach (var match in matches)
|
||||
{
|
||||
if (match.Start > pos)
|
||||
Inlines.Add(new Run(subject.Substring(pos, match.Start - pos)));
|
||||
inlines.Add(new Run(subject.Substring(pos, match.Start - pos)));
|
||||
|
||||
var link = new Run(subject.Substring(match.Start, match.Length));
|
||||
link.Classes.Add("issue_link");
|
||||
Inlines.Add(link);
|
||||
inlines.Add(link);
|
||||
|
||||
pos = match.Start + match.Length;
|
||||
}
|
||||
|
||||
if (pos < subject.Length)
|
||||
Inlines.Add(new Run(subject.Substring(pos)));
|
||||
inlines.Add(new Run(subject.Substring(pos)));
|
||||
|
||||
Inlines.AddRange(inlines);
|
||||
InvalidateTextLayout();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user