System.Windows.Forms.HexBox.KeyInterpreter.PerformPosMoveRight C# (CSharp) Method

PerformPosMoveRight() protected method

protected PerformPosMoveRight ( ) : bool
return bool
            protected virtual bool PerformPosMoveRight()
            {
                long pos = _hexBox._bytePos;
                int cp = _hexBox._byteCharacterPos;
                long sel = _hexBox._selectionLength;

                if(sel != 0)
                {
                    pos += sel;
                    cp = 0;
                    _hexBox.SetPosition(pos, cp);
                    _hexBox.ReleaseSelection();
                }
                else
                {
                    if( !(pos == _hexBox._byteProvider.Length && cp == 0) )
                    {

                        if(cp > 0)
                        {
                            pos = Math.Min(_hexBox._byteProvider.Length, pos+1);
                            cp = 0;
                        }
                        else
                        {
                            cp++;
                        }

                        _hexBox.SetPosition(pos, cp);

                        if(pos > _hexBox._endByte-1)
                        {
                            _hexBox.PerformScrollLineDown();
                        }
                        _hexBox.UpdateCaret();
                        _hexBox.Invalidate();
                    }
                }

                _hexBox.ScrollByteIntoView();
                return true;
            }