• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TextEditor.TextEditorData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.TextEditor.TextEditorData的典型用法代码示例。如果您正苦于以下问题:C# Mono.TextEditor.TextEditorData类的具体用法?C# Mono.TextEditor.TextEditorData怎么用?C# Mono.TextEditor.TextEditorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Mono.TextEditor.TextEditorData类属于命名空间,在下文中一共展示了Mono.TextEditor.TextEditorData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestRemoveTabReverse

		public void TestRemoveTabReverse ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = 
@"\t123456789
\t123[456789
\t123d456789
\t123]456789
\t123456789
\t123456789";
			InsertTabTests.SetSelection (data, true);
			
			MiscActions.RemoveTab (data);
/*			ISegment currentSelection = InsertTabTests.GetSelection (data, true);
			
			Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset);
			Assert.AreEqual (currentSelection.Offset, data.Caret.Offset);
			Assert.AreEqual (currentSelection.EndOffset, data.SelectionAnchor);*/
			
			Assert.IsTrue (data.Document.GetLine (DocumentLocation.MinLine + 0).Length < data.Document.GetLine (DocumentLocation.MinLine + 1).Length);
			Assert.IsTrue (data.Document.GetLine (DocumentLocation.MinLine + 0).Length < data.Document.GetLine (DocumentLocation.MinLine + 2).Length);
			Assert.IsTrue (data.Document.GetLine (DocumentLocation.MinLine + 0).Length < data.Document.GetLine (DocumentLocation.MinLine + 3).Length);
			
			Assert.AreEqual (data.Document.GetLine (DocumentLocation.MinLine + 0).Length, data.Document.GetLine (DocumentLocation.MinLine + 4).Length);
			
			Assert.AreEqual (data.Document.GetLine (DocumentLocation.MinLine + 1).Length, data.Document.GetLine (DocumentLocation.MinLine + 2).Length);
			Assert.AreEqual (data.Document.GetLine (DocumentLocation.MinLine + 1).Length, data.Document.GetLine (DocumentLocation.MinLine + 3).Length);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:29,代码来源:RemoveTabTests.cs


示例2: TestSearchForward

		public void TestSearchForward ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = @"ababab";
			data.SearchEngine.SearchRequest.SearchPattern = "ab";
			SearchResult result = data.SearchForward (0);
			Assert.AreEqual (0, result.Offset);
			Assert.AreEqual (2, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			
			result = data.SearchForward (1);
			Assert.AreEqual (2, result.Offset);
			Assert.AreEqual (4, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			
			result = data.SearchForward (4);
			Assert.AreEqual (4, result.Offset);
			Assert.AreEqual (6, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			
			result = data.SearchForward (5);
			Assert.AreEqual (0, result.Offset);
			Assert.AreEqual (2, result.EndOffset);
			Assert.IsTrue (result.SearchWrapped);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:25,代码来源:SearchTests.cs


示例3: TestInsertTabLine

		public void TestInsertTabLine ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = 
@"123456789
123[456789
123d456789
123]456789
123456789
123456789";
			SetSelection (data, false);
			
			MiscActions.InsertTab (data);
/*			ISegment currentSelection = GetSelection (data, false);
			
			Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset);
			Assert.AreEqual (currentSelection.EndOffset, data.Caret.Offset);*/
			
			Assert.IsTrue (data.Document.GetLine(1).Length > data.Document.GetLine(0).Length);
			Assert.IsTrue (data.Document.GetLine(2).Length > data.Document.GetLine(0).Length);
			Assert.IsTrue (data.Document.GetLine(3).Length > data.Document.GetLine(0).Length);
			Assert.AreEqual (data.Document.GetLine(0).Length, data.Document.GetLine(4).Length);
			Assert.AreEqual (data.Document.GetLine(1).Length, data.Document.GetLine(2).Length);
			Assert.AreEqual (data.Document.GetLine(1).Length, data.Document.GetLine(3).Length);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:26,代码来源:InsertTabTests.cs


示例4: TestBug1700

		public void TestBug1700 ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData ();
			data.Document.Text = "123\n123\n123";
			data.MainSelection = new Selection (1, 2, 3, 2, SelectionMode.Block);
			MiscActions.InsertTab (data);
			
			Assert.AreEqual ("1\t23\n1\t23\n1\t23", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:9,代码来源:EditActionsTest.cs


示例5: TestBug615196_UnIndentCase

		public void TestBug615196_UnIndentCase ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = "\n\t\t\n\t\t\n\t\t\n\n";
			data.Caret.Offset = data.Document.GetLine (2).Offset; // 2nd.Line
			data.MainSelection = new Selection (2, 1, 4, 1);
			MiscActions.RemoveTab (data);
			MiscActions.RemoveTab (data);
			
			Assert.AreEqual ("\n\n\n\t\t\n\n", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:11,代码来源:EditActionsTest.cs


示例6: TestInsertNewLine

		public void TestInsertNewLine ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = "Hello World!";
			data.Caret.Location = new DocumentLocation (1, "Hello".Length + 1);
			MiscActions.InsertNewLine (data);
			Assert.AreEqual (2, data.Document.LineCount);
			Assert.AreEqual (2, data.Caret.Line);
			Assert.AreEqual (1, data.Caret.Column);
			Assert.AreEqual ("Hello" + Environment.NewLine + " World!", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:11,代码来源:InsertNewLineTests.cs


示例7: TestBug613770

		public void TestBug613770 ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = "\n\n\n";
			data.Caret.Offset = 1; // 2nd.Line
			data.Caret.AllowCaretBehindLineEnd = true;
			data.Caret.Column = DocumentLocation.MinColumn + 4;
			DeleteActions.Backspace (data);
			
			Assert.AreEqual ("\n\n\n", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:11,代码来源:VirtualSpacesTests.cs


示例8: Initialize

		public override void Initialize ()
		{
			base.Initialize ();
			dom = Document.Dom;
			textEditorData = Document.TextEditorData;
			
			InitTracker ();
			IEnumerable<string> types = MonoDevelop.Ide.DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			if (dom != null && dom.Project != null)
				policy = base.Document.Project.Policies.Get<CSharpFormattingPolicy> (types);
		}
开发者ID:natosha,项目名称:monodevelop,代码行数:11,代码来源:CSharpTextEditorCompletion.cs


示例9: TestReturnKeyBehavior

		public void TestReturnKeyBehavior ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = "\n\n\n";
			data.Caret.Offset = 1; // 2nd.Line
			data.Caret.AllowCaretBehindLineEnd = true;
			data.Caret.Column = DocumentLocation.MinColumn + 4;
			data.Options.RemoveTrailingWhitespaces = false;
			MiscActions.InsertNewLine (data);
			
			Assert.AreEqual ("\n    \n    \n\n", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:12,代码来源:VirtualSpacesTests.cs


示例10: TestInsertTabBug615196_IndentCase

		public void TestInsertTabBug615196_IndentCase ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData ();
			data.Options = new TextEditorOptions () { IndentStyle = IndentStyle.Smart };
			data.Document.Text = "\n\n\n\n\n";
			data.Caret.Offset = data.Document.GetLine (2).Offset; // 2nd.Line
			data.MainSelection = new Selection (2, 1, 4, 1);
			MiscActions.InsertTab (data);
			MiscActions.InsertTab (data);
			
			Assert.AreEqual ("\n\t\t\n\t\t\n\n\n", data.Document.Text);
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:12,代码来源:MiscActionsTest.cs


示例11: TestReturnKeyBehavior

		public void TestReturnKeyBehavior ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData ();
			data.IndentationTracker = null;
			data.Options.IndentStyle = IndentStyle.Auto;
			data.Document.Text = "\n\n\n";
			data.Caret.Offset = 1; // 2nd.Line
			data.Caret.AllowCaretBehindLineEnd = true;
			data.Caret.Column = DocumentLocation.MinColumn + 4;
			MiscActions.InsertNewLine (data);
			
			Assert.AreEqual ("\n    \n    \n\n", data.Document.Text);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:13,代码来源:VirtualSpacesTests.cs


示例12: TestSimpleUndo

		public void TestSimpleUndo ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData ();
			data.Document.Text = "Hello";
			Assert.IsFalse (data.Document.CanUndo);
			data.Caret.Offset = data.Document.TextLength;
			data.InsertAtCaret ("World");
			Assert.IsTrue (data.Document.CanUndo);
			data.Document.Undo ();
			Assert.IsFalse (data.Document.CanUndo);
			Assert.AreEqual (data.Document.Text, "Hello");
			Assert.AreEqual (data.Document.TextLength, data.Caret.Offset);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:13,代码来源:UndoRedoTests.cs


示例13: TestBug615196

		public void TestBug615196 ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = "\n\nHello World\n";
			data.Caret.Offset = 1; // 2nd.Line
			data.Caret.AllowCaretBehindLineEnd = true;
			data.Caret.Column = DocumentLocation.MinColumn + 4;
			Clipboard clipboard = Clipboard.Get (Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM);
			clipboard.Text = "Test";
			
			ClipboardActions.Paste (data);
			
			Assert.AreEqual ("\n    Test\nHello World\n", data.Document.Text);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:14,代码来源:VirtualSpacesTests.cs


示例14: Create

		public static TextEditorData Create (string input, bool reverse)
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData ();
			
			int offset1 = input.IndexOf ('[');
			int offset2 = input.IndexOf (']');
			var selection = new TextSegment (offset1, offset2 - offset1 - 1);

			data.Text = input.Substring (0, offset1) + input.Substring (offset1 + 1, (offset2 - offset1) - 1) + input.Substring (offset2 + 1);
			if (reverse) {
				data.Caret.Offset = selection.Offset;
				data.SelectionAnchor = selection.EndOffset;
				data.ExtendSelectionTo (selection.Offset);
			} else {
				data.Caret.Offset = selection.EndOffset;
				data.SelectionAnchor = selection.Offset;
				data.ExtendSelectionTo (selection.EndOffset);
			}
			return data;
		}
开发者ID:ischyrus,项目名称:monodevelop,代码行数:20,代码来源:InsertTabTests.cs


示例15: TestExtendSelectionTo

		public void TestExtendSelectionTo ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
data.Document.Text = 
@"123456789
123456789
123456789
123456789
123456789
123456789";
			
			data.SelectionAnchor = 3;
			DocumentLine line = data.Document.GetLine (3);
			
			Assert.IsFalse (data.IsSomethingSelected);
			data.ExtendSelectionTo (line.Offset + 3);
			
			Assert.IsTrue (data.IsSomethingSelected);
			
			Assert.AreEqual (3, data.SelectionRange.Offset);
			Assert.AreEqual (line.Offset + 3, data.SelectionRange.EndOffset);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:22,代码来源:SelectionTests.cs


示例16: TextPasteHandlerWrapper

		public TextPasteHandlerWrapper (Mono.TextEditor.TextEditorData data, MonoDevelop.Ide.Editor.Extension.TextPasteHandler textPasteHandler)
		{
			this.data = data;
			this.textPasteHandler = textPasteHandler;
			data.Paste += HandlePaste;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:6,代码来源:TextPasteHandlerWrapper.cs


示例17: TestInsertTabLineCase3Reverse

		public void TestInsertTabLineCase3Reverse ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = 
@"123d456789
123[456789
123d456789
]123456789
123456789
123456789";
			SetSelection (data, true);
			
			MiscActions.InsertTab (data);
/*			ISegment currentSelection = GetSelection (data, true);
			
			Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset);
			Assert.AreEqual (currentSelection.Offset, data.Caret.Offset);*/
			
			Assert.IsTrue (data.Document.GetLine (DocumentLocation.MinLine + 1).Length > data.Document.GetLine (DocumentLocation.MinLine + 0).Length);
			Assert.IsTrue (data.Document.GetLine (DocumentLocation.MinLine + 2).Length > data.Document.GetLine (DocumentLocation.MinLine + 0).Length);
			
			Assert.AreEqual (data.Document.GetLine (DocumentLocation.MinLine + 0).Length, data.Document.GetLine (DocumentLocation.MinLine + 3).Length);
			Assert.AreEqual (data.Document.GetLine (DocumentLocation.MinLine + 1).Length, data.Document.GetLine (DocumentLocation.MinLine + 2).Length);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:25,代码来源:InsertTabTests.cs


示例18: TestFindNext

		public void TestFindNext ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = @"ababab";
			data.SearchEngine.SearchRequest.SearchPattern = "ab";
			
			data.Caret.Offset = 0;
			SearchResult result = data.FindNext (true);
			Assert.AreEqual (0, result.Offset);
			Assert.AreEqual (2, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			Assert.AreEqual (result.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (result.Length, data.SelectionRange.Length);
			Assert.AreEqual (result.EndOffset, data.Caret.Offset);
			
			result = data.FindNext (true);
			Assert.AreEqual (2, result.Offset);
			Assert.AreEqual (4, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			Assert.AreEqual (result.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (result.Length, data.SelectionRange.Length);
			Assert.AreEqual (result.EndOffset, data.Caret.Offset);
			
			result = data.FindNext (true);
			Assert.AreEqual (4, result.Offset);
			Assert.AreEqual (6, result.EndOffset);
			Assert.IsFalse (result.SearchWrapped);
			Assert.AreEqual (result.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (result.Length, data.SelectionRange.Length);
			Assert.AreEqual (result.EndOffset, data.Caret.Offset);
			
			result = data.FindNext (true);
			Assert.AreEqual (0, result.Offset);
			Assert.AreEqual (2, result.EndOffset);
			Assert.IsTrue (result.SearchWrapped);
			Assert.AreEqual (result.Offset, data.SelectionRange.Offset);
			Assert.AreEqual (result.Length, data.SelectionRange.Length);
			Assert.AreEqual (result.EndOffset, data.Caret.Offset);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:39,代码来源:SearchTests.cs


示例19: TestCompletionWidget

			public TestCompletionWidget (Mono.TextEditor.TextEditorData data)
			{
				this.data = data;
			}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:4,代码来源:CodeCompletionBugTests.cs


示例20: TestSelectAllCaretMovement

		public void TestSelectAllCaretMovement ()
		{
			TextEditorData data = new Mono.TextEditor.TextEditorData  ();
			data.Document.Text = 
				@"123456789
123456789
123456789
123456789
123456789
123456789";
			
			Assert.IsFalse (data.IsSomethingSelected);
			var loc = new DocumentLocation (3, 3);
			data.Caret.Location = loc;
			SelectionActions.SelectAll (data);
			Assert.IsTrue (data.IsSomethingSelected);
			
			Assert.AreEqual (data.SelectionRange.Offset, 0);
			Assert.AreEqual (data.SelectionRange.EndOffset, data.Document.TextLength);
			Assert.AreEqual (loc, data.Caret.Location);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:21,代码来源:SelectionActionTests.cs



注:本文中的Mono.TextEditor.TextEditorData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MonoBehaviour类代码示例发布时间:2022-05-24
下一篇:
C# Index.IndexReader类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap