/* Public members */ public override bool CanGroupWith(Command command) { DeleteTextContentCommand last = command as DeleteTextContentCommand; return((this.Path.Compare(last.Path) == 0) && //Paths are equal (this.text.Length == 1) && //A single char was deleted (this.toRight == last.GetToRight()) && //Directions are equal ((this.toRight && (this.index == last.GetIndex())) || //Deletion is a continuation of the last deletion ((!this.toRight) && (this.index == last.GetIndex() - 1))) && ((this.toRight && (!(Char.IsWhiteSpace(last.GetLastChar()) && (!Char.IsWhiteSpace(GetLastChar()))))) || //A space->non-space sequence is not the case ((!this.toRight) && (!(Char.IsWhiteSpace(last.GetFirstChar()) && (!Char.IsWhiteSpace(GetLastChar()))))))); }
public override Command MergeWith(Command command) { DeleteTextContentCommand last = command as DeleteTextContentCommand; if (this.toRight) { this.text = last.GetText() + this.text; } else { this.text = this.text + last.GetText(); } return(this); }