AvalonStudio.TextEditor.TextEditor.MoveVertical C# (CSharp) Method

MoveVertical() private method

private MoveVertical ( int count, InputModifiers modifiers ) : void
count int
modifiers InputModifiers
return void
        private void MoveVertical(int count, InputModifiers modifiers)
        {
            var caretIndex = CaretIndex;

            if (caretIndex >= 0)
            {
                var currentPosition = TextDocument.GetLocation(caretIndex);

                if (currentPosition.Line + count > 0 && currentPosition.Line + count <= TextDocument.LineCount)
                {
                    var line = TextDocument.Lines[currentPosition.Line - 1 + count];

                    var col = line.EndOffset;

                    if (highestUserSelectedColumn <= line.Length)
                    {
                        col = highestUserSelectedColumn;
                    }

                    CaretIndex = TextDocument.GetOffset(currentPosition.Line + count, col);
                }
            }
        }