From b5b613000ceae4eabb315a8045cd725a31ab341a Mon Sep 17 00:00:00 2001 From: "Neil J. Patel" Date: Mon, 1 Oct 2007 13:44:33 +0000 Subject: [PATCH] 2007-10-01 Neil J. Patel Patch by: Tommi Komulainen * clutter/clutter-entry.c: (clutter_entry_delete_text): Fix characters vs. bytes inconsistency (#520). --- ChangeLog | 7 +++++++ clutter/clutter-entry.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4625b8c7c..4854344a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-01 Neil J. Patel + + Patch by: Tommi Komulainen + + * clutter/clutter-entry.c: (clutter_entry_delete_text): + Fix characters vs. bytes inconsistency (#520). + 2007-09-30 Matthew Allum * clutter/clutter-event.h: diff --git a/clutter/clutter-entry.c b/clutter/clutter-entry.c index 045eb855a..6d43f9f0a 100644 --- a/clutter/clutter-entry.c +++ b/clutter/clutter-entry.c @@ -1439,6 +1439,8 @@ clutter_entry_delete_text (ClutterEntry *entry, { ClutterEntryPrivate *priv; GString *new = NULL; + gint start_bytes; + gint end_bytes; g_return_if_fail (CLUTTER_IS_ENTRY (entry)); @@ -1446,9 +1448,12 @@ clutter_entry_delete_text (ClutterEntry *entry, if (!priv->text) return; + + start_bytes = offset_to_bytes (priv->text, start_pos); + end_bytes = offset_to_bytes (priv->text, end_pos); new = g_string_new (priv->text); - new = g_string_erase (new, start_pos, end_pos - start_pos); + new = g_string_erase (new, start_bytes, end_bytes - start_bytes); clutter_entry_set_text (entry, new->str);