From 8509d7f4ea6c11b88bf6c1b56bad7ebe89c12df7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 4 Jun 2004 01:19:55 +0000 Subject: [PATCH] Calculate the length of the entry contents in characters, not in bytes. Thu Jun 3 21:17:29 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the length of the entry contents in characters, not in bytes. * gtk/gtkentry.c (paste_received): Don't pop up the completion window on paste, noticed by Anders Carlsson. --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ gtk/gtkentry.c | 13 ++++++++++++- 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 051135f1a8..c53a74a920 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Jun 3 21:17:29 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the + length of the entry contents in characters, not in bytes. + + * gtk/gtkentry.c (paste_received): Don't pop up the completion + window on paste, noticed by Anders Carlsson. + Thu Jun 3 20:56:19 2004 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_class_init): Fix the allowed diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 051135f1a8..c53a74a920 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Thu Jun 3 21:17:29 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the + length of the entry contents in characters, not in bytes. + + * gtk/gtkentry.c (paste_received): Don't pop up the completion + window on paste, noticed by Anders Carlsson. + Thu Jun 3 20:56:19 2004 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_class_init): Fix the allowed diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 051135f1a8..c53a74a920 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Thu Jun 3 21:17:29 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the + length of the entry contents in characters, not in bytes. + + * gtk/gtkentry.c (paste_received): Don't pop up the completion + window on paste, noticed by Anders Carlsson. + Thu Jun 3 20:56:19 2004 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_class_init): Fix the allowed diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 051135f1a8..c53a74a920 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Thu Jun 3 21:17:29 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the + length of the entry contents in characters, not in bytes. + + * gtk/gtkentry.c (paste_received): Don't pop up the completion + window on paste, noticed by Anders Carlsson. + Thu Jun 3 20:56:19 2004 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_class_init): Fix the allowed diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 86d4a0f101..1fc2848769 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3418,6 +3418,14 @@ paste_received (GtkClipboard *clipboard, if (text) { gint pos, start, end; + GtkEntryCompletion *completion = gtk_entry_get_completion (entry); + + if (completion) + { + g_signal_handler_block (entry, completion->priv->changed_id); + if (GTK_WIDGET_MAPPED (completion->priv->popup_window)) + _gtk_entry_completion_popdown (completion); + } if (gtk_editable_get_selection_bounds (editable, &start, &end)) gtk_editable_delete_text (editable, start, end); @@ -3425,6 +3433,9 @@ paste_received (GtkClipboard *clipboard, pos = entry->current_pos; gtk_editable_insert_text (editable, text, -1, &pos); gtk_editable_set_position (editable, pos); + + if (completion) + g_signal_handler_unblock (entry, completion->priv->changed_id); } g_object_unref (entry); @@ -4632,7 +4643,7 @@ gtk_entry_completion_timeout (gpointer data) completion->priv->completion_timeout = 0; - if (strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry))) + if (g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), -1) >= completion->priv->minimum_key_length) { gint matches;