private bool backspaceOrForwardDelete(android.view.View view, android.text.Editable
                                              content, int keyCode, android.view.KeyEvent @event, bool isForwardDelete)
        {
            // Ensure the key event does not have modifiers except ALT or SHIFT.
            if (!android.view.KeyEvent.metaStateHasNoModifiers(@event.getMetaState() & ~(android.view.KeyEvent
                                                                                         .META_SHIFT_MASK | android.view.KeyEvent.META_ALT_MASK)))
            {
                return(false);
            }
            // If there is a current selection, delete it.
            if (deleteSelection(view, content))
            {
                return(true);
            }
            // Alt+Backspace or Alt+ForwardDelete deletes the current line, if possible.
            if (@event.isAltPressed() || getMetaState(content, META_ALT_ON) == 1)
            {
                if (deleteLine(view, content))
                {
                    return(true);
                }
            }
            // Delete a character.
            int start = android.text.Selection.getSelectionEnd(content);
            int end;

            if (isForwardDelete || @event.isShiftPressed() || getMetaState(content, META_SHIFT_ON
                                                                           ) == 1)
            {
                end = android.text.TextUtils.getOffsetAfter(content, start);
            }
            else
            {
                end = android.text.TextUtils.getOffsetBefore(content, start);
            }
            if (start != end)
            {
                content.delete(System.Math.Min(start, end), System.Math.Max(start, end));
                return(true);
            }
            return(false);
        }