Browse Source

change marker now shows deletions

pull/15/head
Siegfried Pammer 15 years ago
parent
commit
52bb2f5ac5
  1. 5
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
  2. 13
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DefaultChangeWatcher.cs
  3. 5
      src/AddIns/VersionControl/GitAddIn/Src/GitVersionProvider.cs

5
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs

@ -56,8 +56,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -56,8 +56,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
throw new Exception("Invalid value for ChangeType");
}
// not needed currently - TODO we have no complete SVN/Git support
/*if (!string.IsNullOrEmpty(info.DeletedLinesAfterThisLine)) {
if (!string.IsNullOrEmpty(info.DeletedLinesAfterThisLine)) {
Point pt1 = new Point(5, line.VisualTop + line.Height - textView.ScrollOffset.Y - 4);
Point pt2 = new Point(10, line.VisualTop + line.Height - textView.ScrollOffset.Y);
Point pt3 = new Point(5, line.VisualTop + line.Height - textView.ScrollOffset.Y + 4);
@ -76,7 +75,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -76,7 +75,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
drawingContext.DrawGeometry(Brushes.Red, null, new PathGeometry(new List<PathFigure>() { CreateNAngle(pt1, pt2, pt3) }));
}
}*/
}
}
}
}

13
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DefaultChangeWatcher.cs

@ -75,10 +75,17 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -75,10 +75,17 @@ namespace ICSharpCode.AvalonEdit.AddIn
changeList.Add(new LineChangeInfo(ChangeType.None, ""));
int lastEndLine = 0;
foreach (Edit edit in diff.GetEdits()) {
Console.WriteLine(edit);
int beginLine = textDocument.GetLineByOffset(edit.BeginB).LineNumber;
int endLine = textDocument.GetLineByOffset(edit.EndB).LineNumber;
changeList.InsertRange(changeList.Count, beginLine - lastEndLine, new LineChangeInfo(ChangeType.None, ""));
changeList.InsertRange(changeList.Count, endLine - beginLine, new LineChangeInfo(edit.EditType, ""));
if (edit.EditType == ChangeType.Deleted) {
LineChangeInfo change = changeList[beginLine];
change.DeletedLinesAfterThisLine += baseFile.Substring(edit.BeginA, edit.EndA - edit.BeginA);
changeList[beginLine] = change;
} else
changeList.InsertRange(changeList.Count, endLine - beginLine, new LineChangeInfo(edit.EditType, ""));
lastEndLine = endLine;
}
changeList.InsertRange(changeList.Count, textDocument.LineCount - lastEndLine, new LineChangeInfo(ChangeType.None, ""));
@ -109,8 +116,8 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -109,8 +116,8 @@ namespace ICSharpCode.AvalonEdit.AddIn
void UndoStackPropertyChanged(object sender, PropertyChangedEventArgs e)
{
// if (textDocument.UndoStack.IsOriginalFile)
// SetupInitialFileState();
if (textDocument.UndoStack.IsOriginalFile)
SetupInitialFileState();
}
void ILineTracker.BeforeRemoveLine(DocumentLine line)

5
src/AddIns/VersionControl/GitAddIn/Src/GitVersionProvider.cs

@ -107,8 +107,11 @@ namespace ICSharpCode.GitAddIn @@ -107,8 +107,11 @@ namespace ICSharpCode.GitAddIn
if (!CreateProcess(null, string.Format("cmd /c git cat-file blob {0}", blobHash),
IntPtr.Zero, IntPtr.Zero, true, 0, IntPtr.Zero, Path.GetDirectoryName(fileName), ref startupInfo,
out procInfo))
out procInfo)) {
pipe.DisposeLocalCopyOfClientHandle();
pipe.Close();
return null;
}
pipe.DisposeLocalCopyOfClientHandle();

Loading…
Cancel
Save