本文整理汇总了C#中ITextBuffer.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer.Delete方法的具体用法?C# ITextBuffer.Delete怎么用?C# ITextBuffer.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITextBuffer
的用法示例。
在下文中一共展示了ITextBuffer.Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveChars
private static void RemoveChars(ITextBuffer textBuffer, int start, bool backspace, int count) {
int offset = backspace ? -1 : 0;
for (int i = 0; i < count; i++) {
start += offset;
textBuffer.Delete(new Span(start, 1));
}
}
示例2: DeletePackageMember
public static void DeletePackageMember(this JSONMember item, ITextBuffer buffer)
{
if (item.NextSibling != null && item.NextSibling.Text == "}" && item.PreviousSibling != null)
{
JSONMember prev = item.PreviousSibling as JSONMember;
if (prev != null && prev.Comma != null)
{
Span comma = new Span(prev.Comma.Start, prev.Comma.Length);
buffer.Delete(comma);
}
}
var line = buffer.CurrentSnapshot.GetLineFromPosition(item.Start);
Span lineSpan = new Span(line.Start.Position - 1, line.Length + 1);
buffer.Delete(lineSpan);
}
示例3: ApplyTextChange
public static void ApplyTextChange(ITextBuffer textBuffer, int start, int oldLength, int newLength, string newText)
{
TextChange tc = new TextChange();
tc.OldRange = new TextRange(start, oldLength);
tc.NewRange = new TextRange(start, newLength);
tc.OldTextProvider = new TextProvider(textBuffer.CurrentSnapshot);
if (oldLength == 0 && newText.Length > 0)
{
textBuffer.Insert(start, newText);
}
else if (oldLength > 0 && newText.Length > 0)
{
textBuffer.Replace(new Span(start, oldLength), newText);
}
else
{
textBuffer.Delete(new Span(start, oldLength));
}
}