Alsing.Windows.Forms.SyntaxBox.Caret.MoveRight C# (CSharp) Method

MoveRight() public method

Moves the caret right one step. if the caret is placed at the last column of a row the caret will move down one row and be placed at the first column of that row.
public MoveRight ( bool Select ) : void
Select bool True if a selection should be created from the current caret pos to the new pos
return void
        public void MoveRight(bool Select)
        {
            CropPosition();
            Position.X++;

            if (CurrentRow.IsCollapsed)
            {
                if (Position.X > CurrentRow.Expansion_EndChar)
                {
                    Position.Y = CurrentRow.Expansion_EndRow.Index;
                    Position.X = CurrentRow.Expansion_EndRow.Expansion_StartChar;
                    CropPosition();
                }
                RememberXPos();
                CaretMoved(Select);
            }
            else
            {
                Row xtr = CurrentRow;
                if (Position.X > xtr.Text.Length && !Control.VirtualWhitespace)
                {
                    if (Position.Y < Control.Document.Count - 1)
                    {
                        MoveDown(Select);
                        Position.X = 0;
                        //this.Position.Y ++;
                        CropPosition();
                    }
                    else
                        CropPosition();
                }
                RememberXPos();
                CaretMoved(Select);
            }
        }