Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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.
            }
        }
Exemplo n.º 4
0
 public SnapshotPoint GetInsertPosition(SelectionHelper selectionHelper)
 {
     return selectionHelper.GetLineEndIncludingLineBreak();
 }
Exemplo n.º 5
0
 public SnapshotPoint GetInsertPosition(SelectionHelper selectionHelper)
 {
     return selectionHelper.GetLineStartPoint();
 }