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