本文整理汇总了C#中Mono.TextEditor.TextEditorData类的典型用法代码示例。如果您正苦于以下问题:C# Mono.TextEditor.TextEditorData类的具体用法?C# Mono.TextEditor.TextEditorData怎么用?C# Mono.TextEditor.TextEditorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mono.TextEditor.TextEditorData类属于命名空间,在下文中一共展示了Mono.TextEditor.TextEditorData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}