summaryrefslogtreecommitdiff
path: root/gtk/gtkentry.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-08-16 17:42:54 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-08-16 17:42:54 +0000
commitdb9a5e3d245fd6756a23f51e6fb0126becb5e0b2 (patch)
tree9022cf1b151edbb1b8a31b8a247d16fc7c816ca7 /gtk/gtkentry.c
parent0182cf8ceb949ccabcd10f485358a18c65195237 (diff)
downloadgtk+-db9a5e3d245fd6756a23f51e6fb0126becb5e0b2.tar.gz
Popup completion if paste is at the end (patch was already in 2.8.x).
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)
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r--gtk/gtkentry.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index f1ef78768e..d87047e8ab 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3950,16 +3950,24 @@ paste_received (GtkClipboard *clipboard,
{
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))
@@ -3969,7 +3977,8 @@ paste_received (GtkClipboard *clipboard,
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);
}