[Gtk-sharp-list] TextBuffer InsertWithTags patch

Thiago Milczarek Sayão sayao@brturbo.com
Sun, 15 Feb 2004 14:31:59 -0300


--=-jetRiArqZZ4ZuGe4dX7X
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

This patch adds the function InsertWithTags to
TextBuffer.custom. It doesnt use the native gtk function.

--=-jetRiArqZZ4ZuGe4dX7X
Content-Disposition: attachment; filename=TextBuffer.diff
Content-Type: text/x-patch; name=TextBuffer.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit

--- TextBuffer.custom.orig	2004-02-15 14:12:16.000000000 -0300
+++ TextBuffer.custom	2004-02-15 14:09:10.000000000 -0300
@@ -14,6 +14,19 @@
 	Delete (StartIter, EndIter);
 }
 
+public void InsertWithTags (string text, params TextTag[] tags)
+{
+	TextIter iter;
+	
+	this.Insert (EndIter, text);
+	iter = this.GetIterAtOffset (EndIter.Offset - text.Length);
+
+	foreach (TextTag t in tags)
+	{
+		this.ApplyTag (t, iter, EndIter);
+	}
+}
+
 // overload to paste clipboard contents at cursor editable by default.
 [DllImport("libgtk-win32-2.0-0.dll")]
 static extern void gtk_text_buffer_paste_clipboard (IntPtr raw, IntPtr clip, IntPtr iter, bool default_edit);

--=-jetRiArqZZ4ZuGe4dX7X--