public override bool TryToMerge(IAction followingAction) { InsertTextAction next = followingAction as InsertTextAction; if (next != null && next.Textbox == this.Textbox) { if (next.selectionStart == this.selectionStart + textToInsert.Length) { this.selectionLength += next.selectionLength; this.deletedText += next.deletedText; this.textToInsert += next.textToInsert; next.Execute(); return(true); } if (next.selectionStart + next.selectionLength == this.selectionStart) { this.selectionStart -= next.selectionLength; this.selectionLength += next.selectionLength; this.deletedText = next.deletedText + this.deletedText; this.textToInsert = next.textToInsert + this.textToInsert; next.Execute(); return(true); } } return(false); }
public void InsertText(string textToInsert) { InsertTextAction action = new InsertTextAction( this, textToInsert, this.SelectionStart, this.SelectionLength); RunAction(action); //string oldText = this.Text; //this.BeforeTextChanged(); //InsertTextCore( // this, // textToInsert, // this.SelectionStart, // this.SelectionLength); //this.AfterTextChanged(); //RaiseTextChanged(oldText, this.Text); }
public void InsertText(string textToInsert) { InsertTextAction action = new InsertTextAction( this, textToInsert, this.SelectionStart, this.SelectionLength); RunAction(action); //string oldText = this.Text; //this.BeforeTextChanged(); //InsertTextCore( // this, // textToInsert, // this.SelectionStart, // this.SelectionLength); //this.AfterTextChanged(); //RaiseTextChanged(oldText, this.Text); }
public void SetText(string newValue) { if (newValue == Text || newValue == null) { return; } InsertTextAction action = new InsertTextAction( this, newValue, 0, this.TextLength); RunAction(action); //using (RedrawAccumulator a = new RedrawAccumulator(this.Root, options.Redraw)) //{ // int oldCaretPosition = this.CaretPosition; // this.Text = newValue; // this.SetCaretPosition(oldCaretPosition); //} }
public void SetText(string newValue) { if (newValue == Text || newValue == null) { return; } InsertTextAction action = new InsertTextAction( this, newValue, 0, this.TextLength); RunAction(action); //using (RedrawAccumulator a = new RedrawAccumulator(this.Root, options.Redraw)) //{ // int oldCaretPosition = this.CaretPosition; // this.Text = newValue; // this.SetCaretPosition(oldCaretPosition); //} }