gtksourceview r1945 - in trunk: . gtksourceview



Author: arminb
Date: Sun Apr 13 17:38:12 2008
New Revision: 1945
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=1945&view=rev

Log:
2008-04-13  Armin Burgmeier  <armin arbur net>

	* gtksourceview/gtksourceundomanager.c
	(gtk_source_undo_manager_add_action),
	(gtk_source_undo_manager_insert_text_handler): Handle insertion of
	non-null-terminated strings correctly.


Modified:
   trunk/ChangeLog
   trunk/gtksourceview/gtksourceundomanager.c

Modified: trunk/gtksourceview/gtksourceundomanager.c
==============================================================================
--- trunk/gtksourceview/gtksourceundomanager.c	(original)
+++ trunk/gtksourceview/gtksourceundomanager.c	Sun Apr 13 17:38:12 2008
@@ -693,8 +693,6 @@
 	if (um->priv->running_not_undoable_actions > 0)
 		return;
 
-	g_return_if_fail (strlen (text) >= (guint)length);
-
 	undo_action.action_type = GTK_SOURCE_UNDO_ACTION_INSERT;
 
 	undo_action.action.insert.pos    = gtk_text_iter_get_offset (pos);
@@ -790,7 +788,7 @@
 		*action = *undo_action;
 
 		if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT)
-			action->action.insert.text = g_strdup (undo_action->action.insert.text);
+			action->action.insert.text = g_strndup (undo_action->action.insert.text, undo_action->action.insert.length);
 		else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE)
 			action->action.delete.text = g_strdup (undo_action->action.delete.text);
 		else



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