Mono.TextEditor.TextDocument.Replace C# (CSharp) Method

Replace() public method

public Replace ( int offset, int count, string value ) : void
offset int
count int
value string
return void
		public void Replace (int offset, int count, string value)
		{
			Replace (offset, count, value, AnchorMovementType.Default);
		}

Same methods

TextDocument::Replace ( int offset, int count, string value, ICSharpCode anchorMovementType = AnchorMovementType.Default ) : void

Usage Example

    void SetDiffCellData (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        try
        {
            CellRendererDiff cellRendererDiff = (CellRendererDiff)cell;
            Change change = store.GetValue (iter, objColumn) as Change;
            cellRendererDiff.Visible = !(bool)store.GetValue (iter, statusVisibleColumn);
            if (change == null || !cellRendererDiff.Visible)
            {
                cellRendererDiff.InitCell (treeviewPreview, false, "", "");
                return;
            }
            TextReplaceChange replaceChange = change as TextReplaceChange;
            if (replaceChange == null)
                return;

            var openDocument = IdeApp.Workbench.GetDocument (replaceChange.FileName);
            Mono.TextEditor.TextDocument originalDocument = new Mono.TextEditor.TextDocument ();
            originalDocument.FileName = replaceChange.FileName;
            if (openDocument == null)
            {
                originalDocument.Text = Mono.TextEditor.Utils.TextFileUtility.ReadAllText (replaceChange.FileName);
            }
            else
            {
                originalDocument.Text = openDocument.Editor.Document.Text;
            }

            Mono.TextEditor.TextDocument changedDocument = new Mono.TextEditor.TextDocument ();
            changedDocument.FileName = replaceChange.FileName;
            changedDocument.Text = originalDocument.Text;

            changedDocument.Replace (replaceChange.Offset, replaceChange.RemovedChars, replaceChange.InsertedText);

            string diffString = Mono.TextEditor.Utils.Diff.GetDiffString (originalDocument, changedDocument);

            cellRendererDiff.InitCell (treeviewPreview, true, diffString, replaceChange.FileName);
        }
        catch (Exception e)
        {
            Console.WriteLine (e);
        }
    }
All Usage Examples Of Mono.TextEditor.TextDocument::Replace
TextDocument