Exemplo n.º 1
0
            /// <summary>
            /// Pres the process wm key down_ back.
            /// </summary>
            /// <param name="m">The m.</param>
            /// <returns></returns>
            protected virtual bool PreProcessWmKeyDown_Back(ref Message m)
            {
                if (!HexViewer._byteProvider.SupportsDeleteBytes)
                {
                    return(true);
                }

                long pos = HexViewer.bytePosition;
                long sel = HexViewer._selectionLength;
                int  cp  = HexViewer.byteCharacterPosition;

                long startDelete = (cp == 0 && sel == 0) ? pos - 1 : pos;

                if (startDelete < 0 && sel < 1)
                {
                    return(true);
                }

                long bytesToDelete = (sel > 0) ? sel : 1;

                HexViewer._byteProvider.DeleteBytes(Math.Max(0, startDelete), bytesToDelete);
                HexViewer.UpdateScrollSize();

                if (sel == 0)
                {
                    PerformPosMoveLeftByte();
                }

                HexViewer.ReleaseSelection();
                HexViewer.Invalidate();

                return(true);
            }