public override Command MergeWith(Command command) { InsertTextContentCommand last = command as InsertTextContentCommand; this.index = last.GetIndex(); this.text = last.GetText() + this.text; return(this); }
/* Public members */ public override bool CanGroupWith(Command command) { InsertTextContentCommand last = command as InsertTextContentCommand; return((this.Path.Compare(last.Path) == 0) && //Paths are equal (this.index == (last.GetIndex() + last.GetText().Length)) && //This index is the position after the last text (this.text.Length == 1) && //A single char was inserted (!(Char.IsWhiteSpace(last.GetLastChar()) && (!Char.IsWhiteSpace(GetLastChar()))))); //A space->non-space sequence is not the case }