private void MovePrevious(bool extendSelection) { if (!extendSelection && !textView.Selection.IsEmpty) { textView.Selection.Select(textView.Selection.ActivePoint, textView.Selection.ActivePoint); } var caret = textView.Caret; if (caret.InVirtualSpace) { operations.MoveToEndOfLine(extendSelection); return; } var point = caret.Position.BufferPosition; if (point.Position == 0) { return; } if (point.Position == 1) { operations.MoveToPreviousCharacter(extendSelection); return; } if (point == caret.ContainingTextViewLine.Start) { operations.MoveLineUp(extendSelection); operations.MoveToLastNonWhiteSpaceCharacter(extendSelection); if (navigator.GetExtentOfWord(caret.Position.BufferPosition).IsSignificant) { operations.MoveToNextCharacter(extendSelection); } return; } var boundary = navigator.GetSubwordBoundary(point - 1, forward: false); int end = boundary ?? point; for (int i = point; i > end; i--) { operations.MoveToPreviousCharacter(extendSelection); } }