本文整理汇总了C#中VirtualSnapshotPoint.GetLineAndColumn方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualSnapshotPoint.GetLineAndColumn方法的具体用法?C# VirtualSnapshotPoint.GetLineAndColumn怎么用?C# VirtualSnapshotPoint.GetLineAndColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualSnapshotPoint
的用法示例。
在下文中一共展示了VirtualSnapshotPoint.GetLineAndColumn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceBoxSelectionToEditableBox
private bool ReduceBoxSelectionToEditableBox(ref VirtualSnapshotPoint selectionTop, ref VirtualSnapshotPoint selectionBottom, bool isDelete)
{
int selectionTopColumn, selectionBottomColumn;
ITextSnapshotLine selectionTopLine, selectionBottomLine;
selectionTop.GetLineAndColumn(out selectionTopLine, out selectionTopColumn);
selectionBottom.GetLineAndColumn(out selectionBottomLine, out selectionBottomColumn);
int selectionLeftColumn, selectionRightColumn;
bool horizontallyReversed = selectionTopColumn > selectionBottomColumn;
if (horizontallyReversed)
{
// bottom-left <-> top-right
selectionLeftColumn = selectionBottomColumn;
selectionRightColumn = selectionTopColumn;
}
else
{
// top-left <-> bottom-right
selectionLeftColumn = selectionTopColumn;
selectionRightColumn = selectionBottomColumn;
}
var selectionTopLeft = new VirtualSnapshotPoint(selectionTopLine, selectionLeftColumn);
var selectionBottomRight = new VirtualSnapshotPoint(selectionBottomLine, selectionRightColumn);
SnapshotPoint editable = GetClosestEditablePoint(selectionTopLeft.Position);
int editableColumn;
ITextSnapshotLine editableLine;
editable.GetLineAndColumn(out editableLine, out editableColumn);
Debug.Assert(selectionLeftColumn <= selectionRightColumn);
Debug.Assert(selectionTopLine.LineNumber <= selectionBottomLine.LineNumber);
if (editable > selectionBottomRight.Position)
{
// entirely within readonly output region:
return false;
}
int minPromptLength, maxPromptLength;
MeasurePrompts(editableLine.LineNumber, selectionBottomLine.LineNumber + 1, out minPromptLength, out maxPromptLength);
bool result = true;
if (isDelete)
{
if (selectionLeftColumn > maxPromptLength || maxPromptLength == minPromptLength)
{
selectionTopLine = editableLine;
selectionLeftColumn = Math.Max(selectionLeftColumn, maxPromptLength);
}
}
else
{
if (selectionRightColumn < minPromptLength)
{
// entirely within readonly prompt region:
result = false;
}
else if (maxPromptLength > selectionRightColumn)
{
selectionTopLine = editableLine;
selectionLeftColumn = maxPromptLength;
selectionRightColumn = maxPromptLength;
}
else
{
selectionTopLine = editableLine;
selectionLeftColumn = Math.Max(maxPromptLength, selectionLeftColumn);
}
}
if (horizontallyReversed)
{
// bottom-left <-> top-right
selectionTop = new VirtualSnapshotPoint(selectionTopLine, selectionRightColumn);
selectionBottom = new VirtualSnapshotPoint(selectionBottomLine, selectionLeftColumn);
}
else
{
// top-left <-> bottom-right
selectionTop = new VirtualSnapshotPoint(selectionTopLine, selectionLeftColumn);
selectionBottom = new VirtualSnapshotPoint(selectionBottomLine, selectionRightColumn);
}
return result;
}