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

Insert() public method

public Insert ( int offset, string value ) : int
offset int
value string
return int
		public int Insert (int offset, string value)
		{
			return Replace (offset, 0, value);
		}
		

Usage Example

		static void TestInsertionPoints (string text)
		{
			TextEditorData data = new TextEditorData ();
			List<InsertionPoint> loc = new List<InsertionPoint> ();
			for (int i = 0; i < text.Length; i++) {
				char ch = text[i];
				if (ch == '@') {
					i++;
					ch = text[i];
					loc.Add (new InsertionPoint (data.Document.OffsetToLocation (data.Document.Length), ch == '3' || ch == '2', ch == '3' || ch == '1'));
				} else {
					data.Insert (data.Document.Length, ch.ToString ());
				}
			}
			var parseResult = new NRefactoryParser ().Parse (null, "a.cs", data.Document.Text);
			
			var foundPoints = HelperMethods.GetInsertionPoints (data.Document, parseResult.CompilationUnit.Types[0]);
			Assert.AreEqual (loc.Count, foundPoints.Count, "point count doesn't match");
			for (int i = 0; i < loc.Count; i++) {
				Console.WriteLine (loc[i] + "/" + foundPoints[i]);
				Assert.AreEqual (loc[i].Location, foundPoints[i].Location, "point " + i + " doesn't match");
				Assert.AreEqual (loc[i].ShouldInsertNewLineAfter, foundPoints[i].ShouldInsertNewLineAfter, "point " + i + " ShouldInsertNewLineAfter doesn't match");
				Assert.AreEqual (loc[i].ShouldInsertNewLineBefore, foundPoints[i].ShouldInsertNewLineBefore, "point " + i + " ShouldInsertNewLineBefore doesn't match");
			}
		}
All Usage Examples Of Mono.TextEditor.TextEditorData::Insert