当前位置: 首页>>代码示例>>C#>>正文


C# DocumentChangeEventArgs.GetNewOffset方法代码示例

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


在下文中一共展示了DocumentChangeEventArgs.GetNewOffset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDocumentChanged

 internal void OnDocumentChanged(DocumentChangeEventArgs e)
 {
     InvalidateVisualColumn();
     if (storedCaretOffset >= 0) {
         int newCaretOffset = e.GetNewOffset(storedCaretOffset, AnchorMovementType.Default);
         TextDocument document = textArea.Document;
         if (document != null) {
             // keep visual column
             this.Position = new TextViewPosition(document.GetLocation(newCaretOffset), position.VisualColumn);
         }
     }
     storedCaretOffset = -1;
 }
开发者ID:hardliner66,项目名称:ATMELGitSCC,代码行数:13,代码来源:Caret.cs

示例2: OnDocumentChanged

		internal void OnDocumentChanged(DocumentChangeEventArgs e)
		{
			InvalidateVisualColumn();
			if (storedCaretOffset >= 0) {
				// If the caret is at the end of a selection, we don't expand the selection if something
				// is inserted at the end. Thus we also need to keep the caret in front of the insertion.
				AnchorMovementType caretMovementType;
				if (!textArea.Selection.IsEmpty && storedCaretOffset == textArea.Selection.SurroundingSegment.EndOffset)
					caretMovementType = AnchorMovementType.BeforeInsertion;
				else
					caretMovementType = AnchorMovementType.Default;
				int newCaretOffset = e.GetNewOffset(storedCaretOffset, caretMovementType);
				TextDocument document = textArea.Document;
				if (document != null) {
					// keep visual column
					this.Position = new TextViewPosition(document.GetLocation(newCaretOffset), position.VisualColumn);
				}
			}
			storedCaretOffset = -1;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:20,代码来源:Caret.cs

示例3: textArea_Document_Changing

 void textArea_Document_Changing(object sender, DocumentChangeEventArgs e)
 {
     if (e.Offset + e.RemovalLength == this.StartOffset && e.RemovalLength > 0) {
         Close(); // removal immediately in front of completion segment: close the window
         // this is necessary when pressing backspace after dot-completion
     }
     if (e.Offset == StartOffset && e.RemovalLength == 0 && ExpectInsertionBeforeStart) {
         StartOffset = e.GetNewOffset(StartOffset, AnchorMovementType.AfterInsertion);
         this.ExpectInsertionBeforeStart = false;
     } else {
         StartOffset = e.GetNewOffset(StartOffset, AnchorMovementType.BeforeInsertion);
     }
     EndOffset = e.GetNewOffset(EndOffset, AnchorMovementType.AfterInsertion);
 }
开发者ID:Jaimerh,项目名称:lsystems-csharp-lib,代码行数:14,代码来源:CompletionWindowBase.cs

示例4: textArea_Document_Changing

		void textArea_Document_Changing(object sender, DocumentChangeEventArgs e)
		{
			if (e.Offset == startOffset && e.RemovalLength == 0 && ExpectInsertionBeforeStart) {
				startOffset = e.GetNewOffset(startOffset, AnchorMovementType.AfterInsertion);
				this.ExpectInsertionBeforeStart = false;
			} else {
				startOffset = e.GetNewOffset(startOffset, AnchorMovementType.BeforeInsertion);
			}
			endOffset = e.GetNewOffset(endOffset, AnchorMovementType.AfterInsertion);
		}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:10,代码来源:CompletionWindowBase.cs

示例5: UpdateOnDocumentChange

        /// <inheritdoc/>
        public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
        {
            TextLocation newStartLocation = textArea.Document.GetLocation(e.GetNewOffset(topLeftOffset, AnchorMovementType.AfterInsertion));
            TextLocation newEndLocation = textArea.Document.GetLocation(e.GetNewOffset(bottomRightOffset, AnchorMovementType.BeforeInsertion));

            return new RectangleSelection(textArea,
                                          new TextViewPosition(newStartLocation, GetVisualColumnFromXPos(newStartLocation.Line, startXPos)),
                                          new TextViewPosition(newEndLocation, GetVisualColumnFromXPos(newEndLocation.Line, endXPos)));
        }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:10,代码来源:RectangleSelection.cs

示例6: UpdateOnDocumentChange

		/// <inheritdoc/>
		public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
		{
			if (e == null)
				throw new ArgumentNullException("e");
			int newStartOffset, newEndOffset;
			if (startOffset <= endOffset) {
				newStartOffset = e.GetNewOffset(startOffset, AnchorMovementType.Default);
				newEndOffset = Math.Max(newStartOffset, e.GetNewOffset(endOffset, AnchorMovementType.BeforeInsertion));
			} else {
				newEndOffset = e.GetNewOffset(endOffset, AnchorMovementType.Default);
				newStartOffset = Math.Max(newEndOffset, e.GetNewOffset(startOffset, AnchorMovementType.BeforeInsertion));
			}
			return Selection.Create(
				textArea,
				new TextViewPosition(textArea.Document.GetLocation(newStartOffset), start.VisualColumn),
				new TextViewPosition(textArea.Document.GetLocation(newEndOffset), end.VisualColumn)
			);
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:19,代码来源:SimpleSelection.cs

示例7: UpdateOnDocumentChange

 /// <inheritdoc/>
 public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
 {
     if (e == null)
         throw new ArgumentNullException("e");
     return new SimpleSelection(
         e.GetNewOffset(startOffset, AnchorMovementType.Default),
         e.GetNewOffset(endOffset, AnchorMovementType.Default)
     );
 }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:10,代码来源:SimpleSelection.cs

示例8: UpdateOnDocumentChange

		/// <inheritdoc/>
		public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
		{
			if (e == null)
				throw new ArgumentNullException("e");
			TextViewPosition newStart = start;
			TextViewPosition newEnd = end;
			// by changing the existing TextViewPosition, we preserve the VisualColumn (though it might become invalid)
			// and the IsAtEndOfLine property.
			newStart.Location = textArea.Document.GetLocation(e.GetNewOffset(startOffset, AnchorMovementType.Default));
			newEnd.Location   = textArea.Document.GetLocation(e.GetNewOffset(endOffset, AnchorMovementType.Default));
			return Selection.Create(textArea, newStart, newEnd);
		}
开发者ID:JadeHub,项目名称:Jade,代码行数:13,代码来源:SimpleSelection.cs

示例9: textArea_Document_Changing

        void textArea_Document_Changing(object sender, DocumentChangeEventArgs e)
        {
            if(e.Offset == StartOffset && e.RemovalLength == 0)
                StartOffset = e.GetNewOffset(StartOffset, AnchorMovementType.AfterInsertion);
            else
                StartOffset = e.GetNewOffset(StartOffset, AnchorMovementType.BeforeInsertion);

            EndOffset = e.GetNewOffset(EndOffset, AnchorMovementType.AfterInsertion);
        }
开发者ID:hazama-yuinyan,项目名称:sharpdevelop-bvebinding,代码行数:9,代码来源:GradientTemplateDialog.xaml.cs

示例10: UpdateOnDocumentChange

 /// <inheritdoc/>
 public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
 {
     if (e == null)
         throw new ArgumentNullException("e");
     return Selection.Create(
         textArea,
         new TextViewPosition(textArea.Document.GetLocation(e.GetNewOffset(startOffset, AnchorMovementType.Default)), start.VisualColumn),
         new TextViewPosition(textArea.Document.GetLocation(e.GetNewOffset(endOffset, AnchorMovementType.Default)), end.VisualColumn)
     );
 }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:11,代码来源:SimpleSelection.cs

示例11: UpdateOnDocumentChange

 /// <inheritdoc/>
 public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
 {
     return new RectangleSelection(document,
                                   e.GetNewOffset(StartOffset, AnchorMovementType.AfterInsertion),
                                   e.GetNewOffset(EndOffset, AnchorMovementType.BeforeInsertion));
 }
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:7,代码来源:RectangleSelection.cs


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