sourcegit/src/Models/TextChanges.cs
Jai 663f3237c0 Merge pull request !19 from Jai/fix/copy-content-order
* optimix<Diff>: performance optimization
* fix<DiffViewer>: incorrect order when copying file contents
2021-08-11 11:16:00 +00:00

61 lines
1.8 KiB
C#

using System.Collections.Generic;
namespace SourceGit.Models {
/// <summary>
/// Diff文本文件变化
/// </summary>
public class TextChanges {
public enum LineMode {
None,
Normal,
Indicator,
Added,
Deleted,
}
public class HighlightRange {
public int Start { get; set; }
public int Count { get; set; }
public HighlightRange(int p, int n) { Start = p; Count = n; }
}
public class Line {
public int Index { get; set; } = 0;
public LineMode Mode { get; set; } = LineMode.None;
public string Content { get; set; } = "";
public string OldLine { get; set; } = "";
public string NewLine { get; set; } = "";
public List<HighlightRange> Highlights { get; set; } = new List<HighlightRange>();
public bool IsContent {
get {
return Mode == LineMode.Added
|| Mode == LineMode.Deleted
|| Mode == LineMode.Normal;
}
}
public bool IsDifference {
get {
return Mode == LineMode.Added
|| Mode == LineMode.Deleted
|| Mode == LineMode.None;
}
}
public Line() { }
public Line(int index, LineMode mode, string content, string oldLine, string newLine) {
Index = index;
Mode = mode;
Content = content;
OldLine = oldLine;
NewLine = newLine;
}
}
public bool IsBinary = false;
public List<Line> Lines = new List<Line>();
}
}