changeset 21488:277873603719

Fix #3930 by correctly detecting when we're no longer immediately following a br.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 14 Nov 2007 02:56:34 +0000
parents c8cdf0bcc8e3
children 6e8fc8272d3e
files pidgin/gtkimhtml.c
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Wed Nov 14 00:23:21 2007 +0000
+++ b/pidgin/gtkimhtml.c	Wed Nov 14 02:56:34 2007 +0000
@@ -1165,17 +1165,15 @@
 static void
 gtk_imhtml_undo(GtkIMHtml *imhtml) {
 	g_return_if_fail(GTK_IS_IMHTML(imhtml));
-	g_return_if_fail(imhtml->editable);
-	
-	gtk_source_undo_manager_undo(imhtml->undo_manager);
+	if (imhtml->editable)
+		gtk_source_undo_manager_undo(imhtml->undo_manager);
 }
 
 static void
 gtk_imhtml_redo(GtkIMHtml *imhtml) {
 	g_return_if_fail(GTK_IS_IMHTML(imhtml));
-	g_return_if_fail(imhtml->editable);
-	
-	gtk_source_undo_manager_redo(imhtml->undo_manager);
+	if (imhtml->editable)
+		gtk_source_undo_manager_redo(imhtml->undo_manager);
 
 }
 
@@ -2950,8 +2948,10 @@
 		} else if (imhtml->edit.link == NULL &&
 				gtk_imhtml_is_smiley(imhtml, fonts, c, &smilelen)) {
 			GtkIMHtmlFontDetail *fd;
-
 			gchar *sml = NULL;
+
+			br = FALSE;
+
 			if (fonts) {
 				fd = fonts->data;
 				sml = fd->sml;
@@ -2969,6 +2969,7 @@
 			wpos = 0;
 			ws[0] = 0;
 		} else if (*c == '&' && (amp = purple_markup_unescape_entity(c, &tlen))) {
+			br = FALSE;
 			while(*amp) {
 				ws [wpos++] = *amp++;
 			}
@@ -2997,6 +2998,7 @@
 			c++;
 			pos++;
 		} else if ((len_protocol = gtk_imhtml_is_protocol(c)) > 0){
+			br = FALSE;
 			while(len_protocol--){
 				/* Skip the next len_protocol characters, but make sure they're
 				   copied into the ws array.
@@ -3005,6 +3007,7 @@
 				 pos++;
 			}
 		} else if (*c) {
+			br = FALSE;
 			ws [wpos++] = *c++;
 			pos++;
 		} else {