mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: add inlines once time and mark text layout dirty (#400)
This commit is contained in:
parent
916d376c93
commit
27a68f0d4d
2 changed files with 14 additions and 8 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue