]> Pileus Git - ~andy/gtk/commitdiff
entry-completion: don't move to leftmost character with inline-selection
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 12 Jun 2012 04:13:55 +0000 (00:13 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 13 Jun 2012 21:09:09 +0000 (17:09 -0400)
When inline-selection is set, and the completion popup is showing,
pressing left abruptly jumps to the beginning of the entry text.
This is not expected, since the cursor is at the end of the text before
the left key is pressed, and this behavior is completely inconsistent
with how an entry would normally behave.
The behavior can be observed in Epiphany by selecting a completion match
and pressing left.

This patch changes the code so that it just runs the default entry key
press keybindings in such a case.

https://bugzilla.gnome.org/show_bug.cgi?id=677915

gtk/gtkentry.c

index 59a34f4c65929437abb6f678dfba30d741bfbbd0..cfb6ba5914437cd5bc250ab2eb5cee855bd37fc0 100644 (file)
@@ -9571,14 +9571,15 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
                 gtk_entry_set_text (GTK_ENTRY (completion->priv->entry), "");
             }
 
-          /* Move the cursor to the end for Right/Esc, to the
-             beginning for Left */
+          /* Move the cursor to the end for Right/Esc */
           if (event->keyval == GDK_KEY_Right ||
               event->keyval == GDK_KEY_KP_Right ||
               event->keyval == GDK_KEY_Escape)
             gtk_editable_set_position (GTK_EDITABLE (widget), -1);
+          /* Let the default keybindings run for Left, i.e. either move to the
+           * previous character or select word if a modifier is used */
           else
-            gtk_editable_set_position (GTK_EDITABLE (widget), 0);
+            retval = FALSE;
         }
 
 keypress_completion_out: