public void GotoPrev() { if (this.Diff == null) { return; } MainEditor.GrabFocus(); int line = MainEditor.Caret.Line; int min = Int32.MaxValue, searched = Int32.MaxValue; foreach (var hunk in this.LeftDiff) { min = System.Math.Min(hunk.InsertStart, min); if (hunk.InsertStart > line) { searched = System.Math.Min(hunk.InsertStart, searched); } } if (min < Int32.MaxValue) { MainEditor.Caret.Line = searched == Int32.MaxValue ? min : searched; MainEditor.CenterToCaret(); } }
public void GotoNext() { if (this.Diff == null) { return; } MainEditor.GrabFocus(); int line = MainEditor.Caret.Line; int max = -1, searched = -1; foreach (var hunk in LeftDiff) { max = System.Math.Max(hunk.InsertStart, max); if (hunk.InsertStart < line) { searched = System.Math.Max(hunk.InsertStart, searched); } } if (max >= 0) { MainEditor.Caret.Line = searched < 0 ? max : searched; MainEditor.CenterToCaret(); } }