public bool DoBackspace()
        {
#if DEBUG
            if (dbugEnableTextManRecorder)
            {
                dbug_BackSpaceCount++;
                _dbugActivityRecorder.WriteInfo("TxLMan::DoBackSpace");
                _dbugActivityRecorder.BeginContext();
            }
#endif

            VisualSelectionRangeSnapShot removeSelRange = this.RemoveSelectedText();
            if (!removeSelRange.IsEmpty())
            {
                CancelSelect();
#if DEBUG
                if (dbugEnableTextManRecorder)
                {
                    _dbugActivityRecorder.EndContext();
                }
#endif
                return(true);
            }
            else
            {
                _updateJustCurrentLine = true;

                char deletedChar = _textLineWriter.DoBackspaceOneChar();
                if (deletedChar == '\0')
                {
                    //end of current line
                    if (!IsOnFirstLine)
                    {
                        CurrentLineNumber--;
                        DoEnd();
                        _commandHistoryList.AddDocAction(
                            new DocActionJoinWithNextLine(
                                _textLineWriter.LineNumber, _textLineWriter.CharIndex));
                        JoinWithNextLine();
                    }
#if DEBUG
                    if (dbugEnableTextManRecorder)
                    {
                        _dbugActivityRecorder.EndContext();
                    }
#endif
                    return(false);
                }
                else
                {
                    _commandHistoryList.AddDocAction(
                        new DocActionDeleteChar(
                            deletedChar, _textLineWriter.LineNumber, _textLineWriter.CharIndex));
#if DEBUG
                    if (dbugEnableTextManRecorder)
                    {
                        _dbugActivityRecorder.EndContext();
                    }
#endif
                    return(true);
                }
            }
        }
Exemplo n.º 2
0
 public TextDomEventArgs(bool updateJustCurrentLine, VisualSelectionRangeSnapShot changedSnapShot)
 {
     this.UpdateJustCurrentLine = updateJustCurrentLine;
     this.SelectionSnapShot     = changedSnapShot;
 }