/// <summary> /// Insert the specified text at the insertion point. /// Enhance JohnT: normalize the string after the edit, maintaining the posititon of the IP correctly. /// </summary> public override bool InsertText(string input) { if (!CanInsertText) { return(false); // cannot modify; should we report this somehow? } Invalidate(); // Hide the old selection while we still know where it is. if (input.Contains("\r") || input.Contains("\n")) { MultiLineInsertData inputInsertData = new MultiLineInsertData(this, input, null); Action makeSelection; ParagraphOperations.InsertLines(inputInsertData, out makeSelection); RootBox.Site.PerformAfterNotifications(makeSelection); return(true); } Hookup.InsertText(this, input); StringPosition += input.Length; return(true); }
public override bool InsertRtfString(string input) { if (!CanInsertText) { return(false); // cannot modify; should we report this somehow? } Invalidate(); // Hide the old selection while we still know where it is. Action makeSelection; if (ParagraphOperations == null) { return(false); } if (!ParagraphOperations.InsertRTF(this, input, out makeSelection)) { return(false); } RootBox.Site.PerformAfterNotifications(makeSelection); return(true); }