[gtkhtml] Fix for bug #318973 Caret Mode broken

Irene Huang <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
hi, gtkhtml maintainers

The attached is a patch for bug #318973 Caret Mode broken
I added code to handle situations when cursor->object->parent is NULL
(This is the initial status when caret mode is invoked)

Please review. 

Thanks 

--Irene

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
gtkhtml-caret-mode-broken-318973-02-08.diff (text/x-patch, 2 KB)
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2159
diff -u -r1.2159 ChangeLog
--- src/ChangeLog	6 Feb 2006 09:59:36 -0000	1.2159
+++ src/ChangeLog	8 Feb 2006 11:54:21 -0000
@@ -1,3 +1,10 @@
+2006-02-08  Irene Huang <[email protected]>
+
+	Fixes bug #318973
+
+	* htmlcursor.c: (move_right): Add code to handle cursor movements when 
+	cursor->object->parent is NULL.
+
 2006-02-06  Veerapuram Varadhan <[email protected]>
 
 	** Fixes bug #326366
Index: src/htmlcursor.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlcursor.c,v
retrieving revision 1.74
diff -u -r1.74 htmlcursor.c
--- src/htmlcursor.c	31 Mar 2005 12:44:42 -0000	1.74
+++ src/htmlcursor.c	8 Feb 2006 11:54:21 -0000
@@ -1009,24 +1009,23 @@
 
 	retval = TRUE;
 	if (!html_object_cursor_right (cursor->object, e->painter, cursor)) {
-		if (cursor->object->parent) {
-			gboolean rv;
-			HTMLObject *orig = cursor->object;
+		gboolean rv;
+		HTMLObject *orig = cursor->object;
 
-			if (html_object_get_direction (cursor->object->parent) == HTML_DIRECTION_RTL)
-				rv = move_to_prev_object (cursor, e);
-			else
-				rv = move_to_next_object (cursor, e);
-
-			if (rv && !html_object_is_container (cursor->object) && cursor->object->parent == orig->parent) {
-				if (html_object_get_direction (cursor->object) == HTML_DIRECTION_RTL)
-					cursor->offset --;
-				else
-					cursor->offset ++;
-			}
+		if (cursor->object->parent && 
+			html_object_get_direction (cursor->object->parent) == HTML_DIRECTION_RTL)
+			rv = move_to_prev_object (cursor, e);
+		else
+			rv = move_to_next_object (cursor, e);
 
-			return rv;
+		if (rv && !html_object_is_container (cursor->object) && cursor->object->parent == orig->parent) {
+			if (html_object_get_direction (cursor->object) == HTML_DIRECTION_RTL)
+				cursor->offset --;
+			else
+				cursor->offset ++;
 		}
+
+		return rv;
 	}
 	return retval;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.