Beispiel #1
0
        public ITextSnapshotLine GetLineToSwap(IWpfTextView view, SelectionHelper selectionHelper)
        {
            var startPosition = selectionHelper.GetLineStartPoint();
            var startLineNumber = view.TextSnapshot.GetLineNumberFromPosition(startPosition.Position);

            return view.TextSnapshot.GetLineFromLineNumber(startLineNumber - 1);
        }
Beispiel #2
0
        public ITextSnapshotLine GetLineToSwap(IWpfTextView view, SelectionHelper selectionHelper)
        {
            var endPosition = selectionHelper.GetLineEndPoint();
            var endLineNumber = view.TextSnapshot.GetLineNumberFromPosition(endPosition.Position);

            return view.TextSnapshot.GetLineFromLineNumber(endLineNumber + 1);
        }
Beispiel #3
0
        public void MoveLine(IWpfTextView view)
        {
            try
            {
                var selectionHelper = new SelectionHelper(view);
                selectionHelper.TakeSelectionSnapshot();

                var lineToSwap = this.lineMover.GetLineToSwap(view, selectionHelper);
                var insertPosition = this.lineMover.GetInsertPosition(selectionHelper);
                var offSet = this.lineMover.PerformMove(view, lineToSwap, insertPosition);

                selectionHelper.ApplySelection(offSet);
                view.Caret.EnsureVisible();
            }
            catch
            {
                // Not critical. Swallow the exception.
            }
        }
Beispiel #4
0
 public SnapshotPoint GetInsertPosition(SelectionHelper selectionHelper)
 {
     return selectionHelper.GetLineEndIncludingLineBreak();
 }
Beispiel #5
0
 public SnapshotPoint GetInsertPosition(SelectionHelper selectionHelper)
 {
     return selectionHelper.GetLineStartPoint();
 }