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


C# TextEditorData.LogicalToVisualLine方法代码示例

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


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

示例1: Down

 public static void Down(TextEditorData editor)
 {
     if (!Platform.IsMac)
         CaretMoveActions.Down(editor);
     else
     {
         using (var undo = editor.OpenUndoGroup())
         {
             if (editor.Caret.Line < editor.Document.LineCount)
             {
                 int nextLine = editor.LogicalToVisualLine(editor.Caret.Line);
                 int line = editor.VisualToLogicalLine(nextLine + 1);
                 editor.Caret.Line = line;
             }
         }
     }
 }
开发者ID:hifi,项目名称:monodevelop-justenoughvi,代码行数:17,代码来源:Motion.cs

示例2: Up

 public static void Up(TextEditorData editor)
 {
     if (!Platform.IsMac)
         CaretMoveActions.Up(editor);
     else
     {
         using (var undo = editor.OpenUndoGroup())
         {
             if (editor.Caret.Line > DocumentLocation.MinLine)
             {
                 int visualLine = editor.LogicalToVisualLine(editor.Caret.Line);
                 int line = editor.VisualToLogicalLine(visualLine - 1);
                 editor.Caret.Line = line;
             }
         }
     }
 }
开发者ID:hifi,项目名称:monodevelop-justenoughvi,代码行数:17,代码来源:Motion.cs

示例3: GetOutermostClosedFold

		/// <summary>
		/// Gets the outermost closed fold pertaining to the current caret position
		/// </summary>
		static FoldSegment GetOutermostClosedFold (TextEditorData data)
		{
			FoldSegment currentFold = null;
			int endOffset = -1, startOffset = int.MaxValue;
			IEnumerable<FoldSegment> folds = data.Document.GetFoldingContaining (data.Caret.Line);
			int lineNumber = data.LogicalToVisualLocation (data.Caret.Location).Line;
			if (null != folds) {
				foreach (FoldSegment fold in folds) {
					if (fold.IsFolded && data.LogicalToVisualLine (data.OffsetToLineNumber (fold.Offset)) == lineNumber && 
					    fold.Offset <= startOffset && fold.EndOffset >= endOffset) {
						currentFold = fold;
						startOffset = fold.Offset;
						endOffset = fold.EndOffset;
					}
				}
			}
			
			return currentFold;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:22,代码来源:FoldActions.cs

示例4: PageDown

		public static void PageDown (TextEditorData data)
		{
			int pageLines = (int)((data.VAdjustment.PageSize + ((int)data.VAdjustment.Value % data.LineHeight)) / data.LineHeight);
			int visualLine = data.LogicalToVisualLine (data.Caret.Line);
			visualLine += pageLines;
			int line = System.Math.Min (data.VisualToLogicalLine (visualLine), data.Document.LineCount);
			int offset = data.Document.LocationToOffset (line, data.Caret.Column);
			ScrollActions.PageDown (data);
			data.Caret.Offset = MoveCaretOutOfFolding (data, offset);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:10,代码来源:CaretMoveActions.cs

示例5: Down

		public static void Down (TextEditorData data)
		{
			//on Mac, when deselecting and moving up/down a line, column is always the column of the selection's start
			if (Platform.IsMac && data.IsSomethingSelected && !data.Caret.PreserveSelection) {
				int col = data.MainSelection.Anchor > data.MainSelection.Lead ? data.MainSelection.Lead.Column : data.MainSelection.Anchor.Column;
				int line = data.MainSelection.MaxLine + 1;
				data.ClearSelection ();
				if (line <= data.Document.LineCount) {
					int offset = data.Document.LocationToOffset (line, col);
					data.Caret.SetToOffsetWithDesiredColumn (MoveCaretOutOfFolding (data, offset));
				} else {
					data.Caret.Offset = data.Document.TextLength;
				}
				return;
			}
			
			if (data.Caret.Line < data.Document.LineCount) {
				int nextLine = data.LogicalToVisualLine (data.Caret.Line) + 1;
				int line = data.VisualToLogicalLine (nextLine);
				int offset = MoveCaretOutOfFolding (data, data.LocationToOffset (line, data.Caret.Column), true);
				data.Caret.SetToOffsetWithDesiredColumn (offset);
			} else {
				ToDocumentEnd (data);
			}
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:25,代码来源:CaretMoveActions.cs

示例6: Up

		public static void Up (TextEditorData data)
		{
			int desiredColumn = data.Caret.DesiredColumn;

			//on Mac, when deselecting and moving up/down a line, column is always the column of the selection's start
			if (Platform.IsMac && data.IsSomethingSelected && !data.Caret.PreserveSelection) {
				int col = data.MainSelection.Anchor > data.MainSelection.Lead ? data.MainSelection.Lead.Column : data.MainSelection.Anchor.Column;
				int line = data.MainSelection.MinLine - 1;
				data.ClearSelection ();
				data.Caret.Location = (line >= DocumentLocation.MinLine) ? new DocumentLocation (line, col) : new DocumentLocation (DocumentLocation.MinLine, DocumentLocation.MinColumn);
				data.Caret.SetToDesiredColumn (desiredColumn);
				return;
			}

			if (data.Caret.Line > DocumentLocation.MinLine) {
				int visualLine = data.LogicalToVisualLine (data.Caret.Line);
				int line = data.VisualToLogicalLine (visualLine - 1);
				int offset = MoveCaretOutOfFolding (data, data.Document.LocationToOffset (line, data.Caret.Column), false);
				data.Caret.SetToOffsetWithDesiredColumn (offset);
			} else {
				ToDocumentStart (data);
			}
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:23,代码来源:CaretMoveActions.cs

示例7: PageUp

		public static void PageUp (TextEditorData data)
		{
			using (var undo = data.OpenUndoGroup ()) {
				int pageLines = (int)((data.VAdjustment.PageSize + ((int)data.VAdjustment.Value % data.LineHeight)) / data.LineHeight);
				int visualLine = data.LogicalToVisualLine (data.Caret.Line);
				visualLine -= pageLines;
				int line = System.Math.Max (data.VisualToLogicalLine (visualLine), DocumentLocation.MinLine);
				int offset = data.LocationToOffset (line, data.Caret.Column);
				ScrollActions.PageUp (data);
				data.Caret.Offset = MoveCaretOutOfFolding (data, offset);
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:12,代码来源:CaretMoveActions.cs


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