public void Change() { var behavior = new VSBehavior(); behavior.Add("filename0", 0, 1); behavior.Add("filename1", 1, 1); behavior.Add("filename0", 100, 2); behavior.Add("filename3", 1, 1); behavior.Add("filename0", 1000, 3); behavior.Change("filename0", 150, 1, 1); Assert.IsTrue(behavior.CurrentItem.Equals("filename0", 1001, 4)); behavior.Change("filename0", 0, 10, 1); Assert.IsTrue(behavior.CurrentItem.Equals("filename0", 1011, 5)); behavior.Backward(); behavior.Backward(); Assert.IsTrue(behavior.CurrentItem.Equals("filename0", 110, 3)); behavior.Backward(); behavior.Backward(); Assert.IsTrue(behavior.CurrentItem.Equals("filename0", 10, 2)); }
/// <summary> /// Modified Handler /// </summary> void SciControlModified(ScintillaControl sci, int position, int modificationType, string text, int length, int linesAdded, int line, int intfoldLevelNow, int foldLevelPrev) { var startPosition = sciPrevPosition < position ? sciPrevPosition : position; if (linesAdded < 0) { length = -length; } #if DEBUG TraceManager.Add(nameof(SciControlModified)); TraceManager.Add(behavior.ToString()); TraceManager.Add(sci.FileName); TraceManager.Add("startPosition: " + startPosition); TraceManager.Add("length: " + length); TraceManager.Add("linesAdded: " + linesAdded); #endif behavior.Change(sci.FileName, startPosition, length, linesAdded); sciPrevPosition = sci.CurrentPos; #if DEBUG TraceManager.Add(nameof(SciControlModified)); TraceManager.Add(behavior.ToString()); #endif }