2006-08-16 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkentry.c (paste_received): Popup completion if paste
+ is at the end (patch was already in 2.8.x). (#165714,
+ Christian Persch)
+
* gtk/gtknotebook.c (gtk_notebook_set_current_page): Explain
some quirks of this function. (#351112)
2006-08-16 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkentry.c (paste_received): Popup completion if paste
+ is at the end (patch was already in 2.8.x). (#165714,
+ Christian Persch)
+
* gtk/gtknotebook.c (gtk_notebook_set_current_page): Explain
some quirks of this function. (#351112)
{
gint pos, start, end;
gint length = -1;
- GtkEntryCompletion *completion = gtk_entry_get_completion (entry);
+ gboolean popup_completion;
+ GtkEntryCompletion *completion;
+
+ completion = gtk_entry_get_completion (entry);
if (entry->truncate_multiline)
length = truncate_multiline (text);
+ /* only complete if the selection is at the end */
+ popup_completion = (entry->text_length == MAX (entry->current_pos, entry->selection_bound));
+
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 (!popup_completion && completion->priv->changed_id > 0)
+ g_signal_handler_block (entry, completion->priv->changed_id);
}
if (gtk_editable_get_selection_bounds (editable, &start, &end))
gtk_editable_insert_text (editable, text, length, &pos);
gtk_editable_set_position (editable, pos);
- if (completion)
+ if (completion &&
+ !popup_completion && completion->priv->changed_id > 0)
g_signal_handler_unblock (entry, completion->priv->changed_id);
}