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

PerformPosMoveLeft() protected method

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

                if(sel != 0)
                {
                    cp = 0;
                    _hexBox.SetPosition(pos, cp);
                    _hexBox.ReleaseSelection();
                }
                else
                {
                    if(pos == 0 && cp == 0)
                        return true;

                    if(cp > 0)
                    {
                        cp--;
                    }
                    else
                    {
                        pos = Math.Max(0, pos-1);
                        cp++;
                    }

                    _hexBox.SetPosition(pos, cp);

                    if(pos < _hexBox._startByte)
                    {
                        _hexBox.PerformScrollLineUp();
                    }
                    _hexBox.UpdateCaret();
                    _hexBox.Invalidate();
                }

                _hexBox.ScrollByteIntoView();
                return true;
            }