void VisualElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (VisualElement.CaptureMouse())
     {
         var line = HexMouseLocation.Create(wpfHexViewHost.HexView, e, insertionPosition: false).HexViewLine;
         editorOperations.SelectLine(line, (Keyboard.Modifiers & ModifierKeys.Shift) != 0);
         mouseCaptured = true;
         e.Handled     = true;
         return;
     }
 }
        public override void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            var  mouseLoc       = GetLocation(e);
            bool isOffsetColumn = mouseLoc.HexViewLine.BufferLine.GetLinePositionInfo(mouseLoc.Position).IsOffset;
            int  clickCount     = e.ClickCount;

            if (isOffsetColumn)
            {
                clickCount = 3;
            }
            else if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == ModifierKeys.Control)
            {
                clickCount = 2;
            }
            switch (clickCount)
            {
            default:
            case 1:
                bool isShift = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
                SelectToMousePosition(mouseLoc, isShift);
                break;

            case 2:
                editorOperations.MoveCaret(mouseLoc.HexViewLine, mouseLoc.Point.X, false, hexMoveToFlags);
                editorOperations.SelectCurrentWord();
                break;

            case 3:
                editorOperations.SelectLine(mouseLoc.HexViewLine, false);
                // Seems to match VS behavior
                var end = mouseLoc.HexViewLine.TextRight;
                end += wpfHexView.FormattedLineSource.ColumnWidth;
                if (mouseLoc.Point.X < end)
                {
                    wpfHexView.Caret.MoveTo(mouseLoc.HexViewLine.BufferStart);
                }
                break;
            }
            wpfHexView.Caret.EnsureVisible();
            mouseLeftDownInfo = new MouseLeftDownInfo(GetSelectionOrCaretIfNoSelection(), mouseLoc.Point, clickCount, wpfHexView.BufferLines);
        }