Mono.TextEditor.TextEditorData.PasteText C# (CSharp) Method

PasteText() public method

public PasteText ( int offset, string text, byte copyData, IDisposable &undoGroup ) : int
offset int
text string
copyData byte
undoGroup IDisposable
return int
		public int PasteText (int offset, string text, byte[] copyData, ref IDisposable undoGroup)
		{
			if (TextPasteHandler != null) {
				string newText;
				try {
					newText = TextPasteHandler.FormatPlainText (offset, text, copyData);
				} catch (Exception e) {
					Console.WriteLine ("Text paste handler exception:" + e);
					newText = text;
				}
				if (newText != text) {
					var inserted = Insert (offset, text);
					if (options.GenerateFormattingUndoStep) {
						undoGroup.Dispose ();
						undoGroup = OpenUndoGroup ();
					}
					var result = Replace (offset, inserted, newText);
					if (Paste != null)
						Paste (offset, text, result);
					return result;
				}
			}
			var insertedChars = Insert (offset, text);
			if (options.GenerateFormattingUndoStep) {
				undoGroup.Dispose ();
				undoGroup = OpenUndoGroup ();
			}
			if (Paste != null)
				Paste (offset, text, insertedChars);
			return insertedChars;
		}

Usage Example

Example #1
0
        static int PastePlainText(TextEditorData data, int offset, string text)
        {
            int inserted = data.Insert(offset, text);

            data.PasteText(offset, text, inserted);
            return(inserted);
        }
All Usage Examples Of Mono.TextEditor.TextEditorData::PasteText