gtkhtml r8778 - trunk/gtkhtml



Author: mbarnes
Date: Tue Mar 11 15:34:45 2008
New Revision: 8778
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=8778&view=rev

Log:
2008-03-11  Matthew Barnes  <mbarnes redhat com>

	** Fixes bug #266206 (original patch by Owen Taylor)

	* gtkhtml/gtkhtml.c (get_surrounding_text):
	Fix problem where we'd call gtk_im_context_set_surrounding()
	with and uninitialized value for offset.

	* gtkhtml/gtkhtml.c (gtk_html_im_delete_surrounding_cb):
	Handle the case where offset < 0 and n_chars < -offset.



Modified:
   trunk/gtkhtml/ChangeLog
   trunk/gtkhtml/gtkhtml.c

Modified: trunk/gtkhtml/gtkhtml.c
==============================================================================
--- trunk/gtkhtml/gtkhtml.c	(original)
+++ trunk/gtkhtml/gtkhtml.c	Tue Mar 11 15:34:45 2008
@@ -3186,6 +3186,7 @@
 	gchar *text = NULL;
 
 	if (!html_object_is_text (o)) {
+		*offset = 0;
 		if (e->cursor->offset == 0) {
 			prev = html_object_prev_not_slave (o);
 			if (html_object_is_text (prev)) {
@@ -3201,7 +3202,6 @@
 			} else
 				return NULL;
 		}
-		*offset = 0;
 	} else
 		*offset = e->cursor->offset;
 
@@ -3257,8 +3257,9 @@
 		html_engine_set_mark (html->engine);
 		html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position + offset + n_chars);
 		html_engine_delete (html->engine);
-		if (offset >= 0)
-			html_cursor_exactly_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position);
+		if (offset < 0)
+			orig_position -= MIN (n_chars, - offset);
+		html_cursor_jump_to_position_no_spell (html->engine->cursor, html->engine, orig_position);
 	}
 	return TRUE;
 }



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