[Gtk-sharp-list] Patch for TextBuffer

Thiago Milczarek Sayão sayao@brturbo.com
Sat, 21 Feb 2004 14:56:51 -0300


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

I did a patch some days ago that got commited. It was the InsertWithTags
patch. I didn't notice that the Insert function take 2 arguments, the
iter and the text, so i did the InsertWithTags function take just two
argument that is the text and the tags (i forgot the iter).

This patch corrects the InsertWithTags to take three arguments, the
iter, the text and the tags.

The second patch add alias to the functions Insert, InsertWithTags and
InsertPixbuf to automatically take EndIter as the iter argument. I don't
know if its a good idea, so i did a separated patch to let mkestner
decide :)

Sorry about forgetting the iter argument on the first patch.

Big hug,
Thiago.

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

--- TextBuffer.custom	2004-02-19 20:18:43.000000000 -0300
+++ TextBuffer.custom.modified	2004-02-21 14:27:13.000000000 -0300
@@ -22,16 +22,20 @@
 	gtk_text_buffer_paste_clipboard(Handle, clipboard.Handle, IntPtr.Zero, true);
 }
 
-public void InsertWithTags (string text, params TextTag[] tags)
+public void InsertWithTags (Gtk.TextIter iter, string text, params Gtk.TextTag[] tags)
 {
-	TextIter iter;
-	
-	this.Insert (EndIter, text);
-	iter = this.GetIterAtOffset (EndIter.Offset - text.Length);
+	Gtk.TextIter start;
+	int offset;
+
+	offset = iter.Offset;
+	Insert (iter, text);
+
+	start = GetIterAtOffset (offset);
+	iter = GetIterAtOffset (offset + text.Length);
 
 	foreach (TextTag t in tags)
 	{
-		this.ApplyTag (t, iter, EndIter);
+		this.ApplyTag (t, start, iter);
 	}
 }
 

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

--- TextBuffer.custom	2004-02-21 14:47:24.000000000 -0300
+++ TextBuffer.custom.modified2	2004-02-21 14:47:11.000000000 -0300
@@ -39,3 +39,17 @@
 	}
 }
 
+public void Insert (string text)
+{
+	Insert (EndIter, text);
+}
+
+public void InsertPixbuf (Gdk.Pixbuf pixbuf)
+{
+	InsertPixbuf (EndIter, pixbuf);
+}
+
+public void InsertWithTags (string text, params Gtk.TextTag[] tags)
+{
+	InsertWithTags (EndIter, text, tags);
+}

--=-GENBZoAIbdvsd08a8nEh--