public VisualSelectionRangeSnapShot DoDelete() { //recursive #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.WriteInfo("TxLMan::DoDelete"); _dbugActivityRecorder.BeginContext(); } #endif VisualSelectionRangeSnapShot removedRange = this.RemoveSelectedText(); if (removedRange.IsEmpty()) { updateJustCurrentLine = true; char deletedChar = textLineWriter.DoDeleteOneChar(); if (deletedChar == '\0') { //end of this line commandHistory.AddDocAction( new DocActionJoinWithNextLine( textLineWriter.LineNumber, textLineWriter.ProperCharIndex)); JoinWithNextLine(); updateJustCurrentLine = false; } else { commandHistory.AddDocAction( new DocActionDeleteChar( deletedChar, textLineWriter.LineNumber, textLineWriter.ProperCharIndex)); char nextChar = textLineWriter.NextChar; if (nextChar != '\0') { if (!CanCaretStopOnThisChar(nextChar)) { //TODO: review return range here again return(DoDelete()); } } } } #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.EndContext(); } #endif return(removedRange); }
public VisualSelectionRangeSnapShot DoDelete() { //recursive #if DEBUG if (dbugEnableTextManRecorder) { dbugTextManRecorder.WriteInfo("TxLMan::DoDelete"); dbugTextManRecorder.BeginContext(); } #endif VisualSelectionRangeSnapShot removedRange = this.RemoveSelectedText(); if (removedRange.IsEmpty()) { updateJustCurrentLine = true; char deletedChar = textLineWriter.DoDelete(); //some language if (deletedChar == '\0') { commandHistory.AddDocAction( new DocActionJoinWithNextLine( textLineWriter.LineNumber, textLineWriter.CharIndex)); JoinWithNextLine(); updateJustCurrentLine = false; } else { commandHistory.AddDocAction( new DocActionDeleteChar( deletedChar, textLineWriter.LineNumber, textLineWriter.CharIndex)); char nextChar = textLineWriter.NextChar; if (nextChar != '\0' && textLineWriter.NextCharWidth < 1) { //recursive DoDelete(); } } } #if DEBUG if (dbugEnableTextManRecorder) { dbugTextManRecorder.EndContext(); } #endif return(removedRange); }
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(); commandHistory.AddDocAction( new DocActionJoinWithNextLine( textLineWriter.LineNumber, textLineWriter.ProperCharIndex)); JoinWithNextLine(); } #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.EndContext(); } #endif return(false); } else { commandHistory.AddDocAction( new DocActionDeleteChar( deletedChar, textLineWriter.LineNumber, textLineWriter.ProperCharIndex)); #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.EndContext(); } #endif return(true); } } }