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

C# Document.DocumentLine类代码示例

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

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



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

示例1: ColorizeLine

 protected override void ColorizeLine(DocumentLine line)
 {
   var sections = _textEditor.OnHighlightLine(line);
   if (sections != null)
     foreach (var section in sections)
       ChangeLinePart(section.Offset, section.Offset + section.Length, element => ApplyColorToElement(element, section.Color));
 }
开发者ID:rsdn,项目名称:nitra,代码行数:7,代码来源:NitraTextEditor.cs


示例2: RawlyIndentLine

		public void RawlyIndentLine(int tabsToInsert, ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line)
		{
			if (!_doBeginUpdateManually)
				document.BeginUpdate();
			/*
			 * 1) Remove old indentation
			 * 2) Insert new one
			 */

			// 1)
			int prevInd = 0;
			int curOff = line.Offset;
			if (curOff < document.TextLength)
			{
				char curChar = '\0';
				while (curOff < document.TextLength && ((curChar = document.GetCharAt(curOff)) == ' ' || curChar == '\t'))
				{
					prevInd++;
					curOff++;
				}

				document.Remove(line.Offset, prevInd);
			}

			// 2)
			string indentString = "";
			for (int i = 0; i < tabsToInsert; i++)
				indentString += dEditor.Editor.Options.IndentationString;

			document.Insert(line.Offset, indentString);
			if (!_doBeginUpdateManually)
				document.EndUpdate();
		}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:33,代码来源:DIndentationStrategy.cs


示例3: LineAdapter

			public LineAdapter(TextDocument document, DocumentLine line)
			{
				Debug.Assert(document != null);
				Debug.Assert(line != null);
				this.document = document;
				this.line = line;
			}
开发者ID:ootsby,项目名称:SharpDevelop,代码行数:7,代码来源:AvalonEditDocumentAdapter.cs


示例4: VisualLine

		internal VisualLine(TextView textView, DocumentLine firstDocumentLine)
		{
			Debug.Assert(textView != null);
			Debug.Assert(firstDocumentLine != null);
			this.textView = textView;
			this.FirstDocumentLine = firstDocumentLine;
		}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:7,代码来源:VisualLine.cs


示例5: IndentLine

 public void IndentLine(TextDocument document, DocumentLine line)
 {
     if (document == null || line == null)
     {
         return;
     }
     DocumentLine previousLine = line.PreviousLine;
     if (previousLine != null)
     {
         ISegment indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset);
         string indentation = document.GetText(indentationSegment);
         if (Program.OptionsObject.Editor_AgressiveIndentation)
         {
             string currentLineTextTrimmed = (document.GetText(line)).Trim();
             string lastLineTextTrimmed = (document.GetText(previousLine)).Trim();
             char currentLineFirstNonWhitespaceChar = ' ';
             if (currentLineTextTrimmed.Length > 0)
             {
                 currentLineFirstNonWhitespaceChar = currentLineTextTrimmed[0];
             }
             char lastLineLastNonWhitespaceChar = ' ';
             if (lastLineTextTrimmed.Length > 0)
             {
                 lastLineLastNonWhitespaceChar = lastLineTextTrimmed[lastLineTextTrimmed.Length - 1];
             }
             if (lastLineLastNonWhitespaceChar == '{' && currentLineFirstNonWhitespaceChar != '}')
             {
                 indentation += "\t";
             }
             else if (currentLineFirstNonWhitespaceChar == '}')
             {
                 if (indentation.Length > 0)
                 {
                     indentation = indentation.Substring(0, indentation.Length - 1);
                 }
                 else
                 {
                     indentation = string.Empty;
                 }
             }
             /*if (lastLineTextTrimmed == "{" && currentLineTextTrimmed != "}")
             {
                 indentation += "\t";
             }
             else if (currentLineTextTrimmed == "}")
             {
                 if (indentation.Length > 0)
                 {
                     indentation = indentation.Substring(0, indentation.Length - 1);
                 }
                 else
                 {
                     indentation = string.Empty;
                 }
             }*/
         }
         indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset);
         document.Replace(indentationSegment, indentation);
     }
 }
开发者ID:not1ce111,项目名称:Spedit,代码行数:60,代码来源:EditorIndetation.cs


示例6: Colorize

        /*
        protected override void Colorize(ITextRunConstructionContext context)
        {
            //base.Colorize(context);
            foreach (var line in context.Document.Lines)
            {
                ColorizeText(line, context.Document.GetText(line));

            }
        }
         */
        protected override void ColorizeLine(DocumentLine line)
        {
            if (CurrentContext == null) return;

                string text = CurrentContext.Document.GetText(line);
                ColorizeText(line, text);
        }
开发者ID:votrongdao,项目名称:DaxStudio,代码行数:18,代码来源:WordHighlighTransformer.cs


示例7: IndentLine

        public virtual void IndentLine(TextDocument document, DocumentLine line)
        {
            if(line == null)
                throw new ArgumentNullException("line");

            formatting_strategy.IndentLine(editor, editor.Document.GetLineByNumber(line.LineNumber));
        }
开发者ID:hazama-yuinyan,项目名称:BVEEditor,代码行数:7,代码来源:IndentationStrategyAdapter.cs


示例8: HeightTreeNode

		internal HeightTreeNode(DocumentLine documentLine, double height)
		{
			this.documentLine = documentLine;
			this.totalCount = 1;
			this.lineNode = new HeightTreeLineNode(height);
			this.totalHeight = height;
		}
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:HeightTreeNode.cs


示例9: ColorizeLine

 protected override void ColorizeLine(DocumentLine line)
 {
     int lineStartOffset = line.Offset;
     string text = CurrentContext.Document.GetText(line);
     int start = 0;
     int index;
     while ((index = text.IndexOf("AvalonEdit", start)) >= 0) {
         base.ChangeLinePart(
             lineStartOffset + index, // startOffset
             lineStartOffset + index + 10, // endOffset
             (VisualLineElement element) => {
                 // This lambda gets called once for every VisualLineElement
                 // between the specified offsets.
                 Typeface tf = element.TextRunProperties.Typeface;
                 // Replace the typeface with a modified version of
                 // the same typeface
                 element.TextRunProperties.SetTypeface(new Typeface(
                     tf.FontFamily,
                     FontStyles.Italic,
                     FontWeights.Bold,
                     tf.Stretch
                 ));
             });
         start = index + 1; // search for next occurrence
     }
 }
开发者ID:Refactoring,项目名称:CIIP,代码行数:26,代码来源:ColorizeAvalonEdit.cs


示例10: Colorize

        /// <inheritdoc/>
        protected override void Colorize(ITextRunConstructionContext context)
        {
            if (context == null)
                throw new ArgumentNullException(nameof(context));
            CurrentContext = context;

            currentDocumentLine = context.VisualLine.FirstDocumentLine;
            firstLineStart = currentDocumentLineStartOffset = currentDocumentLine.Offset;
            currentDocumentLineEndOffset = currentDocumentLineStartOffset + currentDocumentLine.Length;

            if (context.VisualLine.FirstDocumentLine == context.VisualLine.LastDocumentLine)
            {
                ColorizeLine(currentDocumentLine);
            }
            else
            {
                ColorizeLine(currentDocumentLine);
                // ColorizeLine modifies the visual line elements, loop through a copy of the line elements
                foreach (VisualLineElement e in context.VisualLine.Elements.ToArray())
                {
                    int elementOffset = firstLineStart + e.RelativeTextOffset;
                    if (elementOffset >= currentDocumentLineEndOffset)
                    {
                        currentDocumentLine = context.Document.GetLineByOffset(elementOffset);
                        currentDocumentLineStartOffset = currentDocumentLine.Offset;
                        currentDocumentLineEndOffset = currentDocumentLineStartOffset + currentDocumentLine.Length;
                        ColorizeLine(currentDocumentLine);
                    }
                }
            }
            currentDocumentLine = null;
            CurrentContext = null;
        }
开发者ID:arkanoid1,项目名称:Yanitta,代码行数:34,代码来源:DocumentColorizingTransformer.cs


示例11: GetCompletionData

        /// <summary>
        /// Retrieve completion suggestions
        /// </summary>
        /// <param name="completionWord">Word to complete</param>
        /// <param name="content">Script that we're working with</param>
        /// <param name="lineContent">Content of the current line</param>
        /// <param name="line">Line object from AvaloneEdit</param>
        /// <param name="runbookToken">Token containing the name of the runbook (if not runbook, null)</param>
        /// <param name="position">Caret offset</param>
        /// <param name="triggerChar">Not used</param>
        /// <param name="triggerTag">Counter</param>
        public void GetCompletionData(string completionWord, string content, string lineContent, DocumentLine line, Token runbookToken, int position, char? triggerChar, long triggerTag)
        {
            if (_requestTrigger != 0 && triggerTag <= _requestTrigger)
                return;

            DismissGetCompletionResults();
            ProcessCompletion(content, triggerChar, completionWord, runbookToken, position, triggerTag);
        }
开发者ID:peterschen,项目名称:SMAStudio,代码行数:19,代码来源:CompletionProvider.cs


示例12: CommentLine

 public bool CommentLine(TextDocument document, DocumentLine documentLine)
 {
     if (Mode == CommentMode.BeginOfLine)
     {
         return CommentAtBeginOfLine(document, documentLine);
     }
     return CommentAtBeginOfText(document, documentLine);
 }
开发者ID:mookiejones,项目名称:miEditor,代码行数:8,代码来源:CodeCommenter.cs


示例13: IsEmpty

 private bool IsEmpty( DocumentLine dl )
 {
     for ( int i = dl.Offset; i<dl.EndOffset; i++){
                         char ch = ta.Document.GetCharAt(i);
                         if ((ch!=' ')&&(ch!='\t')) return false;
                 }
                 return true;
 }
开发者ID:voland,项目名称:ViSD,代码行数:8,代码来源:CmdNextParagraph.cs


示例14:

		void ILineTracker.LineInserted(DocumentLine insertionPos, DocumentLine newLine)
		{
			ILineTracker targetTracker = targetObject.Target as ILineTracker;
			if (targetTracker != null)
				targetTracker.LineInserted(insertionPos, newLine);
			else
				Deregister();
		}
开发者ID:AkshayVats,项目名称:SuperShell,代码行数:8,代码来源:WeakLineTracker.cs


示例15:

		void ILineTracker.SetLineLength(DocumentLine line, int newTotalLength)
		{
			CheckIsHighlighting();
			int number = line.LineNumber;
			isValid[number] = false;
			if (number < firstInvalidLine)
				firstInvalidLine = number;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:DocumentHighlighter.cs


示例16: CollapsedLineSection

 internal CollapsedLineSection(HeightTree heightTree, DocumentLine start, DocumentLine end)
 {
     this.heightTree = heightTree;
     this.start = start;
     this.end = end;
     #if DEBUG
     this.ID = "#" + (nextId++);
     #endif
 }
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:9,代码来源:CollapsedLineSection.cs


示例17: IsBracketOnly

 bool IsBracketOnly(TextDocument document, DocumentLine documentLine)
 {
     var lineText = document.GetText(documentLine).Trim();
     return lineText == "{" || string.IsNullOrEmpty(lineText)
         || lineText.StartsWith("//", StringComparison.Ordinal)
         || lineText.StartsWith("/*", StringComparison.Ordinal)
         || lineText.StartsWith("*", StringComparison.Ordinal)
         || lineText.StartsWith("'", StringComparison.Ordinal);
 }
开发者ID:arkanoid1,项目名称:Yanitta,代码行数:9,代码来源:BracketSearcher.cs


示例18: HighlightTask

			public HighlightTask(ITextEditor editor, DocumentLine currentLine, TextView textView)
			{
				this.fileName = editor.FileName;
				this.textView = textView;
				this.snapshot = editor.Document.CreateSnapshot();
				this.lineText = textView.Document.GetText(currentLine);
				this.offset = currentLine.Offset;
				this.task = new Task(Process);
			}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:XamlColorizer.cs


示例19: IndentLine

        public override void IndentLine(TextDocument textDocument, DocumentLine line)
        {
            TextDocumentAccessor documentAccessor = new TextDocumentAccessor(textDocument, line.LineNumber, line.LineNumber);
            Indent(documentAccessor, false);

            if (documentAccessor.Text.Length == 0)
            {
                base.IndentLine(textDocument, line);
            }
        }
开发者ID:123marvin123,项目名称:PawnPlus,代码行数:10,代码来源:IndentationStrategy.cs


示例20: GetContinuationType

 private string GetContinuationType(DocumentLine line)
 {
     if (line == null) return string.Empty;
     var text = _editor.Document.GetText(line).TrimStart();
     if (text.StartsWith(Gherkin.Given)) return Gherkin.Given;
     if (text.StartsWith(Gherkin.When)) return Gherkin.When;
     if (text.StartsWith(Gherkin.Then)) return Gherkin.Then;
     if (Gherkin.FunctionKeywords.Any(f => text.StartsWith(f))) return string.Empty;
     return GetContinuationType(line.PreviousLine);
 }
开发者ID:testpulse,项目名称:Pickle-Studio,代码行数:10,代码来源:GherkinCodeCompletionStrategy.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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