]> Pileus Git - ~andy/gtk/commitdiff
Popup completion if paste is at the end (patch was already in 2.8.x).
authorMatthias Clasen <mclasen@redhat.com>
Wed, 16 Aug 2006 17:42:54 +0000 (17:42 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 16 Aug 2006 17:42:54 +0000 (17:42 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkentry.c

index ffcbedcb96cda8c107bc9a2e0c86101e82a5545b..d34937d9a32587627bb221c528195b1350e2a9cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 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)
 
index ffcbedcb96cda8c107bc9a2e0c86101e82a5545b..d34937d9a32587627bb221c528195b1350e2a9cb 100644 (file)
@@ -1,5 +1,9 @@
 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)
 
index f1ef78768ec43ee51524f664969d4a9e80d89ea6..d87047e8ab7fa90feeeecb7b2f55337b4f86f97b 100644 (file)
@@ -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);
     }