mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-27 21:35: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
|
@ -2,8 +2,7 @@
|
|||
{
|
||||
public enum InlineElementType
|
||||
{
|
||||
None = 0,
|
||||
Keyword,
|
||||
Keyword = 0,
|
||||
Link,
|
||||
CommitSHA,
|
||||
Code,
|
||||
|
@ -11,10 +10,10 @@
|
|||
|
||||
public class InlineElement
|
||||
{
|
||||
public InlineElementType Type { get; set; } = InlineElementType.None;
|
||||
public int Start { get; set; } = 0;
|
||||
public int Length { get; set; } = 0;
|
||||
public string Link { get; set; } = "";
|
||||
public InlineElementType Type { get; }
|
||||
public int Start { get; }
|
||||
public int Length { get; }
|
||||
public string Link { get; }
|
||||
|
||||
public InlineElement(InlineElementType type, int start, int length, string link)
|
||||
{
|
||||
|
@ -24,7 +23,7 @@
|
|||
Link = link;
|
||||
}
|
||||
|
||||
public bool Intersect(int start, int length)
|
||||
public bool IsIntersecting(int start, int length)
|
||||
{
|
||||
if (start == Start)
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue