本文整理汇总了C#中Mono.TextEditor.ReplaceEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ReplaceEventArgs类的具体用法?C# ReplaceEventArgs怎么用?C# ReplaceEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReplaceEventArgs类属于Mono.TextEditor命名空间,在下文中一共展示了ReplaceEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextReplaced
public void TextReplaced (object sender, ReplaceEventArgs args)
{
if (args.Count > 0)
TextRemove (args.Offset, args.Count);
if (args.Value != null && args.Value.Length > 0)
TextInsert (args.Offset, args.Value);
}
示例2: TextReplaced
public void TextReplaced (object sender, ReplaceEventArgs args)
{
if (args.Count > 0)
TextRemove (args.Offset, args.Count);
if (!string.IsNullOrEmpty (args.Value))
TextInsert (args.Offset, args.Value);
}
示例3: UpdateUndoStackOnReplace
// The undo stack needs to be updated on replace, because the text editor
// draws a replace operation marker at the left margin.
public void UpdateUndoStackOnReplace (ReplaceEventArgs args)
{
foreach (UndoOperation op in undoStack) {
op.InformTextReplace (args);
}
// since we're only displaying the undo stack it's not required to update the redo stack
// foreach (UndoOperation op in redoStack) {
// op.InformTextReplace (args);
// }
}
示例4: BufferChanged
private void BufferChanged (object sender, ReplaceEventArgs args)
{
if (TextChanged != null)
TextChanged (this, EventArgs.Empty);
}
示例5: EditorDocumentTextReplacing
/// <summary>
/// Marks necessary lines modified when text is replaced
/// </summary>
private void EditorDocumentTextReplacing (object sender, ReplaceEventArgs e)
{
int startLine = widget.Editor.Document.OffsetToLineNumber (e.Offset),
endLine = widget.Editor.Document.OffsetToLineNumber (e.Offset + Math.Max (e.Count, e.Value != null ? e.Value.Length : 0)),
lineCount = 0;
string[] tokens = null;
if (startLine < endLine) {
// change crosses line boundary
lineCount = endLine - startLine;
lineCount = Math.Min (lineCount, annotations.Count - startLine);
if (lineCount > 0)
annotations.RemoveRange (startLine - 1, lineCount);
if (!string.IsNullOrEmpty (e.Value)) {
for (int i=0; i<lineCount; ++i)
annotations.Insert (startLine - 1, locallyModified);
}
return;
} else if (0 == e.Count) {
// insert
tokens = e.Value.Split (new string[]{Environment.NewLine}, StringSplitOptions.None);
lineCount = tokens.Length - 1;
for (int i=0; i<lineCount; ++i) {
annotations.Insert (Math.Min (startLine, annotations.Count), locallyModified);
}
} else if (startLine > endLine) {
// revert
UpdateAnnotations (null, null);
return;
}
SetAnnotation (startLine, locallyModified);
}
示例6: OnTextReplacing
void OnTextReplacing (object s, ReplaceEventArgs a)
{
if (a.Count > 0) {
oldReplaceText = widget.TextEditor.Document.GetTextAt (a.Offset, a.Count);
} else {
oldReplaceText = "";
}
}
示例7: TextReplaced
public void TextReplaced (object sender, ReplaceEventArgs args)
{
throw new NotSupportedException ("Operation not supported on this line splitter.");
}
示例8: HandleDataDocumentTextReplaced
void HandleDataDocumentTextReplaced (object sender, ReplaceEventArgs e)
{
var data = dict[(Document)sender];
localUpdate.Remove (data);
info.Document.Editor.Replace (e.Offset, e.Count, e.Value);
localUpdate.Add (data);
CreateDiff ();
}
示例9: OnTextReplacing
protected virtual void OnTextReplacing (ReplaceEventArgs args)
{
if (TextReplacing != null)
TextReplacing (this, args);
}
示例10: InterruptFoldWorker
void IBuffer.Replace (int offset, int count, string value)
{
if (atomicUndoLevel == 0) {
if (this.syntaxMode != null && !SuppressHighlightUpdate)
Mono.TextEditor.Highlighting.SyntaxModeService.WaitUpdate (this);
}
InterruptFoldWorker ();
// Mono.TextEditor.Highlighting.SyntaxModeService.WaitForUpdate (true);
// Debug.Assert (count >= 0);
// Debug.Assert (0 <= offset && offset + count <= Length);
int oldLineCount = this.LineCount;
var args = new ReplaceEventArgs (offset, count, value);
if (Partitioner != null)
Partitioner.TextReplacing (args);
OnTextReplacing (args);
value = args.Value;
/* insert/repla
lock (syncObject) {
int endOffset = offset + count;
foldSegments = new List<FoldSegment> (foldSegments.Where (s => (s.Offset < offset || s.Offset >= endOffset) &&
(s.EndOffset <= offset || s.EndOffset >= endOffset)));
}*/
UndoOperation operation = null;
if (!isInUndo) {
operation = new UndoOperation (args, count > 0 ? GetTextAt (offset, count) : "");
if (currentAtomicOperation != null) {
currentAtomicOperation.Add (operation);
} else {
OnBeginUndo ();
undoStack.Push (operation);
OnEndUndo (new UndoOperationEventArgs (operation));
}
redoStack.Clear ();
}
buffer.Replace (offset, count, value);
foldSegmentTree.UpdateOnTextReplace (this, args);
splitter.TextReplaced (this, args);
if (Partitioner != null)
Partitioner.TextReplaced (args);
OnTextReplaced (args);
UpdateUndoStackOnReplace (args);
if (operation != null)
operation.Setup (this, args);
if (this.syntaxMode != null && !SuppressHighlightUpdate) {
Mono.TextEditor.Highlighting.SyntaxModeService.StartUpdate (this, this.syntaxMode, offset, value != null ? offset + value.Length : offset + count);
}
if (oldLineCount != LineCount)
this.CommitLineToEndUpdate (this.OffsetToLocation (offset).Line);
}
示例11: UpdateSegments
public static void UpdateSegments (IEnumerable<ISegment> segments, ReplaceEventArgs args)
{
int delta = -args.Count + (!string.IsNullOrEmpty (args.Value) ? args.Value.Length : 0);
foreach (ISegment segment in segments) {
if (args.Offset < segment.Offset) {
segment.Offset += delta;
} else if (args.Offset <= segment.EndOffset) {
segment.Length += delta;
}
}
}
示例12: TextReplaced
public abstract void TextReplaced (ReplaceEventArgs args);
示例13: TextReplacing
public virtual void TextReplacing (ReplaceEventArgs args)
{
}
示例14: UpdateConflictsOnTextReplace
void UpdateConflictsOnTextReplace (object sender, ReplaceEventArgs e)
{
Document.UpdateSegments (GetAllConflictingSegments (), e);
}
示例15: UpdateConflictsOnTextReplace
void UpdateConflictsOnTextReplace (object sender, ReplaceEventArgs e)
{
this.UpdateDiff ();
Mono.TextEditor.Document.UpdateSegments (GetAllConflictingSegments (), e);
}