void Command_Diff_CopyLeftRight(bool moveLeft) { if (DiffTarget == null) { throw new Exception("Diff not in progress"); } var target = TabsParent.GetIndex(this) < DiffTarget.TabsParent.GetIndex(DiffTarget) ? this : DiffTarget; var source = target == this ? DiffTarget : this; if (!moveLeft) { Helpers.Swap(ref target, ref source); } // If both tabs are active only do this from the target tab var bothActive = TabsParent.TabIsActive(DiffTarget); if ((bothActive) && (target != this)) { return; } var strs = source.GetSelectionStrings(); target.ReplaceSelections(strs); // If both tabs are active queue an empty edit so undo will take both back to the same place if (bothActive) { source.ReplaceSelections(strs); } }
void Command_Diff_NextPrevious(bool next, bool shiftDown) { if (DiffTarget == null) { throw new Exception("Diff not in progress"); } if ((TabsParent.GetIndex(this) < DiffTarget.TabsParent.GetIndex(DiffTarget)) && (DiffTarget.Active)) { return; } var lines = Selections.AsParallel().AsOrdered().Select(range => GetDiffNextPrevious(range, next)).ToList(); for (var pass = 0; pass < 2; ++pass) { var target = pass == 0 ? this : DiffTarget; var sels = lines.Select(tuple => new Range(target.Data.GetOffset(tuple.Item2, 0, true), target.Data.GetOffset(tuple.Item1, 0, true))).ToList(); if (shiftDown) { sels.AddRange(target.Selections); } target.SetSelections(sels); } }
void Command_Window_TabIndex(bool activeOnly) { ReplaceSelections((TabsParent.GetIndex(this, activeOnly) + 1).ToString()); }