changeset 649:779c04b844f4

[gaim-migrate @ 659] hehe, i told ya it'd break everything :) committer: Tailor Script <tailor@pidgin.im>
author Todd Kulesza <fflewddur>
date Wed, 09 Aug 2000 04:20:12 +0000
parents 07165959309b
children 8db764ce9c3f
files src/conversation.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Aug 09 04:09:10 2000 +0000
+++ b/src/conversation.c	Wed Aug 09 04:20:12 2000 +0000
@@ -782,7 +782,7 @@
 
 void surround(GtkWidget *entry, char *pre, char *post)
 {
-	int pos = GTK_EDITABLE(entry)->current_pos;
+	int temp, pos = GTK_EDITABLE(entry)->current_pos;
 	int dummy;
 	int start, finish;
 	if (GTK_EDITABLE(entry)->has_selection) {
@@ -801,10 +801,20 @@
 		gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
 		gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post));
 	} else {
+		temp = pos;
 		gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos);
-		dummy = pos;
-		gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
-		gtk_editable_set_position(GTK_EDITABLE(entry), pos);
+		if (temp == pos)
+		{
+			dummy = pos + strlen(pre);
+			gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
+			gtk_editable_set_position(GTK_EDITABLE(entry), dummy);
+		}
+		else
+		{
+			dummy = pos;
+			gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
+			gtk_editable_set_position(GTK_EDITABLE(entry), pos);
+		}
 	}
 	gtk_widget_grab_focus(entry);
 }