[evolution-patches] [gtkhtml] fix for deleting around tables which was broken lately (beginning of March)




Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2102
diff -u -p -r1.2102 ChangeLog
--- ChangeLog	9 Mar 2005 16:15:57 -0000	1.2102
+++ ChangeLog	10 Mar 2005 14:26:11 -0000
@@ -1,3 +1,14 @@
+2005-03-10  Radek Doulik  <rodo novell com>
+
+	* test-suite.c (test_delete_around_table): added new test for
+	deleting around tables which was broken lately (on 2005-02-03)
+
+	* htmlengine-edit-cut-and-paste.c (check_for_simple_delete): use
+	check_for_simple_containers on object parents rather than on
+	objects. this fixes deletion when cursor is before/after table.
+	(check_for_simple_containers): add table cell to simple containers
+	as they are same sa cluev's
+
 2005-03-07  Radek Doulik  <rodo novell com>
 
 	* htmltext.c (html_text_cursor_next_slave): make sure we handle
Index: htmlengine-edit-cut-and-paste.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-cut-and-paste.c,v
retrieving revision 1.109
diff -u -p -r1.109 htmlengine-edit-cut-and-paste.c
--- htmlengine-edit-cut-and-paste.c	9 Mar 2005 15:54:59 -0000	1.109
+++ htmlengine-edit-cut-and-paste.c	10 Mar 2005 14:26:22 -0000
@@ -1723,6 +1723,7 @@ check_for_simple_containers (HTMLObject 
 			switch (child->klass->type) {
 			case HTML_TYPE_CLUEFLOW:
 			case HTML_TYPE_CLUEV:
+			case HTML_TYPE_TABLECELL:
 				break;
 			default:
 				return FALSE;
@@ -1739,7 +1740,7 @@ check_for_simple_delete (HTMLObject *sta
 {
 	HTMLObject *common_parent = get_common_parent (start, end);
 
-	if (common_parent && check_for_simple_containers (start, common_parent) && check_for_simple_containers (end, common_parent))
+	if (common_parent && check_for_simple_containers (start->parent, common_parent) && check_for_simple_containers (end->parent, common_parent))
 		return TRUE;
 
 	return FALSE;
Index: test-suite.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/test-suite.c,v
retrieving revision 1.11
diff -u -p -r1.11 test-suite.c
--- test-suite.c	9 Mar 2005 15:54:59 -0000	1.11
+++ test-suite.c	10 Mar 2005 14:26:43 -0000
@@ -39,6 +39,7 @@ static int test_delete_nested_cluevs_and
 static int test_insert_nested_cluevs (GtkHTML *html);
 static int test_indentation_plain_text (GtkHTML *html);
 static int test_indentation_plain_text_rtl (GtkHTML *html);
+static int test_delete_around_table (GtkHTML *html);
 
 static Test tests[] = {
 	{ "cursor movement", NULL },
@@ -57,6 +58,7 @@ static Test tests[] = {
 	{ "insert nested cluev's", test_insert_nested_cluevs },
 	{ "indentation in plain text", test_indentation_plain_text },
 	{ "indentation in plain text (RTL)", test_indentation_plain_text_rtl },
+	{ "delete around table", test_delete_around_table },
 	{ NULL, NULL }
 };
 
@@ -540,6 +542,32 @@ test_capitalize_upcase_lowcase_word (Gtk
 	printf ("test_capitalize_upcase_lowcase_word: lower OK\n");
 
 	printf ("test_capitalize_upcase_lowcase_word: passed\n");
+
+	return TRUE;
+}
+
+static int
+test_delete_around_table (GtkHTML *html)
+{
+	load_editable (html, "<table><tr><td></td></tr></table><br>abc");
+
+	html_cursor_jump_to_position (html->engine->cursor, html->engine, 3);
+
+	if (html->engine->cursor->offset != 0
+	    || html->engine->cursor->position != 3)
+		return FALSE;
+
+	gtk_html_command (html, "delete-back");
+
+	if (html->engine->cursor->offset != 1
+	    || html->engine->cursor->position != 2)
+		return FALSE;
+
+	html_engine_end_of_document (html->engine);
+
+	if (html->engine->cursor->offset != 3
+	    || html->engine->cursor->position != 7)
+		return FALSE;
 
 	return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]